This script places bricks but it can only place them in the Baseplate, if the mouse is pointing another part it does nothing. there aren't any errors in the output. here is the code:
plr = game.Players.LocalPlayer
repeat wait() until plr.Character
char = plr.Character
m = plr:GetMouse()
c = workspace.CurrentCamera
posX = script.posX
posY = script.posY
posZ = script.posZ
local p = Instance.new("Part")
p.Parent = workspace
p.Size = Vector3.new(4,1,2)
p.Anchored = true
p.Transparency = 0.5
p.CanCollide = false
p.Massless = true
p.Color = Color3.fromRGB(255, 89, 89)
p.Material = Enum.Material.Brick
p.CastShadow = true
p.Reflectance = 0
p.Name = "Brick"
p.Archivable = true
p.Locked = false
p.BackSurface = "Smooth"
p.BottomSurface = "Smooth"
p.FrontSurface = "Smooth"
p.LeftSurface = "Smooth"
p.RightSurface = "Smooth"
p.TopSurface = "Smooth"
p.CollisionGroupId = 0
p.Shape = "Block"
game["Run Service"].RenderStepped:connect(function()
if m.Target.Name == "Brick" then
posX.Value = m.Hit.p.X
posY.Value = char.HumanoidRootPart.CFrame.Y-2.5 --this was different at first but I changed it to be the same as the baseplate (it didn't work)
posZ.Value = m.Hit.p.Z
end
if m.Target.Name == "Baseplate" then
posX.Value = m.Hit.p.X
posY.Value = char.HumanoidRootPart.CFrame.Y-2.5
posZ.Value = m.Hit.p.Z
p.CFrame = CFrame.new(posX.Value,posY.Value,posZ.Value)
end
end)
local spl = Instance.new("SelectionPartLasso")
spl.Parent = char
spl.Humanoid = char.Humanoid
spl.Part = p
spl.Visible = true
m.Button1Down:connect(function()
local p2 = p:Clone()
p2.Parent = workspace
p2.Size = Vector3.new(4,1,2)
p2.Anchored = true
p2.Transparency = 0
p2.CanCollide = true
p2.Massless = false
p2.Color = Color3.fromRGB(255, 255, 255)
p2.Material = Enum.Material.Plastic
p2.CastShadow = true
p2.Reflectance = 0
p2.Name = "Brick"
p2.Archivable = true
p2.Locked = false
p2.BackSurface = "Smooth"
p2.BottomSurface = "Smooth"
p2.FrontSurface = "Smooth"
p2.LeftSurface = "Smooth"
p2.RightSurface = "Smooth"
p2.TopSurface = "Smooth"
p2.CollisionGroupId = 0
p2.Shape = "Block"
local valuee = Instance.new("StringValue")
valuee.Name = plr.Name
valuee.Parent = p2
end)

1 comment
lol im dumb. thanks