#Building system not working
1 messages · Page 1 of 1 (latest)
script:
local players = game:GetService("Players")
local player = players.LocalPlayer
local mousePart = workspace:WaitForChild("MousePart")
local mouse = player:GetMouse()
local RN = game:GetService("RunService")
mousePart.Transparency = 0.5
mousePart.CanCollide = false
mouse.TargetFilter = mousePart
local x, y, z = mouse.Hit.X, mouse.Hit.Y, mouse.Hit.Z
local folder = Instance.new("Folder")
folder.Parent = workspace
folder.Name = player.Name .. "'s Folder"
RN.PreRender:Connect(function()
local x, y, z = mouse.Hit.X, mouse.Hit.Y, mouse.Hit.Z
if mouse.Target then
mousePart.CFrame = CFrame.new(math.round(x) + 0.5, math.round(y) + 0.5, math.round(z) + 0.5)
end
end)
mouse.Button1Down:Connect(function()
if mouse.Target then
local x, y, z = mouse.Hit.X, mouse.Hit.Y, mouse.Hit.Z
local PPart = Instance.new("Part")
PPart.Parent = folder
PPart.Transparency = 0
PPart.Name = "PlasticBlock"
PPart.CanCollide = true
PPart.Anchored = true
PPart.Material = Enum.Material.Plastic
PPart.Size = Vector3.new(1, 1, 1)
PPart.CFrame= CFrame.new(math.round(x) + 0.5, math.round(y)+ 0.5, math.round(z) + 0.5)
end
end)
to lock the part to 1 stud