I made this build script, but it won't work and i am not getting any errors, what suppose to happen is 1.wait until the GUI is pressed 2.Make a clone of the model 3.Make the clone follow the mouse 4.test if the player wants to place the object in the plot 5.makes another clone and place it where the player wants to put it
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local ReinforcedIronWall = game.Workspace.BluePrintWalls.ReinforcedIronWall
---------------------------------------------------------------------
local function round (n)
return math.floor(n + 0.5)
end
---------------------------------------------------------------------
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(a,b)
if not b
then if a.KeyCode == Enum.KeyCode.R then
ReinforcedIronWall:SetPrimaryPartCFrame(ReinforcedIronWall.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(90),0))
end
end
end)
---------------------------------------------------------------------
script.Parent.MouseButton1Click:Connect(function()
local CloneReinforcedIronWall = ReinforcedIronWall:Clone()
CloneReinforcedIronWall.Parent = game.Workspace.ClonedObjects
CloneReinforcedIronWall.Name = "ClonedReinforcedIronWall"
local ClonedReinforcedIronwall = game.Workspace.ClonedObjects.ClonedReinforcedIronWall
mouse.TargetFilter = game.Workspace.ClonedObjects:WaitForChild("ClonedReinforcedIronWall")
mouse.Move:Connect(function()
CloneReinforcedIronWall:SetPrimaryPartCFrame(CFrame.new(round(mouse.Hit.Position.X),round(mouse.Hit.Position.Y),round(mouse.Hit.Position.Z)) + Vector3.new(0,5,0))
mouse.Button1Down:Connect(function()
local ObjectX = CloneReinforcedIronWall.Primarypart.Position.X
local ObjectX = CloneReinforcedIronWall.Primarypart.Position.X
local ObjectY = CloneReinforcedIronWall.Primarypart.Position.Y
local ObjectY = CloneReinforcedIronWall.Primarypart.Position.Y
local ObjectZ = CloneReinforcedIronWall.Primarypart.Position.Z
local ObjectZ = CloneReinforcedIronWall.Primarypart.Position.Z
if
ObjectX < game.Workspace.Plot.Position.X - 150 == true and
ObjectX > game.Workspace.Plot.Position.X + 150 == true and
ObjectY > game.Workspace.Plot.Position.Y == true and
ObjectY < game.Workspace.Plot.Position.Y + 1500 == true and
ObjectZ < game.Workspace.Plot.Position.Z + 150 == true and
ObjectZ > game.Workspace.Plot.Position.Z + 150 == true
then
local BluePrint = game.Workspace.ClonedObjects.ClonedReinforcedIronWall.Primarypart.Position
local PlacingObject = game.Workspace.Walls.ReinforcedIronWall:Clone()
PlacingObject:SetPrimaryPartCFrame(CFrame.new(BluePrint))
PlacingObject.Parent = game.Workspace.PlacedObjects
end
end)
end)
end)
---------------------------------------------------------------------
please help, i don't understand why it wont work because i can't make it to work.Thank you in advance

1 comment
try this: https://scriptinghelpers.org/blog/creating-a-furniture-placement-system