Greetings, In my factory game, I have some traffic cones which I want to script to be able to place them in the workspace clicking in the part you want to place it.
How could I do that?
PD: I'm a novice scripter in Roblox, so I just know basics, and some other things.
Make a tool place? Ok sure here is code:
(Make a server script and a local script, also make a RemoteEvent in the tool)
In a local script (in tool)
local rEvent = script.Parent.RemoteEvent --the removeEvent game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function() rEvent:FireServer(game.Players.LocalPlayer:GetMouse().Hit) end)
In a server script (in tool)
local tool = script.Parent --the tool local model = workspace.RandomModel --the model you want to clone local rEvent = script.Parent.RemoteEvent --the removeEvent rEvent.OnServerEvent:Connect(function(plr, cf) if plr.Character:FindFirstChild(tool.Name) then --check if tool is equipped local cl = model:Clone() if cl.ClassName == "Model" then cl:SetPrimaryPartCFrame(CFrame.new(cf.Position)) else cl.CFrame = CFrame.new(cf.Position) end end end)
Does this help? If you have questions ask me!