This is a normal script inside of ModuleScript that is inside of StarterGui
Filtering enabled is on
--Pieces
repeat wait() until script.Parent.Parent.Parent.Parent
local Player = script.Parent.Parent.Parent
local Mouse = Player:GetMouse()
local slab = script.Parent.Parent.Refrences.Slab:Clone()
Mouse.Button1Down:connect(function()
if script.Parent.Parent.MaterialPicker.Placing.Value == true then
wait(.1)
local SlabClone = Player.Character.Slab:Clone()
SlabClone.Parent = game.Workspace
SlabClone.Transparency = 0
SlabClone.CanCollide = true
end
end)
while true do
wait(.1)
if script.Parent.Parent.MaterialPicker.Placing.Value == true then
slab.Parent = Player.Character
-- local material = script.Parent.Parent.MaterialPicker.MainFrame.CurrentMaterial.Value
local x = math.ceil(Mouse.Hit.p.X)-2
local z = math.ceil(Mouse.Hit.p.Z)-2
local y = math.ceil(Mouse.Hit.p.Y)-2
x1 = x%4
y1 = y%4
z1 = z%4
x2 = x + (4 - x1)
y2 = y + (4 - y1)
z2 = z + (4 - z1)
slab.CFrame = CFrame.new(x2,y2,z2)
slab.Transparency = .5
-- slab.Material = Enum.Material.material
slab.CanCollide = false
else
slab.Transparency = 1
end
end

1 comment
It's a clone, not a new instance