I have an object that gets placed through a tool. Here is the tools script (local script):
local Mouse = game.Players.LocalPlayer:GetMouse()
local tool = script.Parent
local Equipped = false
tool.Equipped:Connect(function()
Equipped = true
end)
tool.Unequipped:connect(function()
Equipped = false
end)
Mouse.Button1Down:Connect(function(player)
if Equipped then
local Target = Mouse.Target
Mouse.TargetFilter = game.Players.LocalPlayer.Character
if Target.Name == "Air" then
wait(.1)
game.ReplicatedStorage.Place:FireServer(Target.CFrame, "Dirt")
Target:Destoy()
end
end
end)
This passes info to the server so the server can save it. Here is the server script (errors on line 3 where it clones the object to be placed) :
game.ReplicatedStorage.Place.OnServerEvent:Connect(function(CdaFrame, ClonedObject)
local clone = game.ReplicatedStorage:FindFirstChild(ClonedObject)
clone:Clone().Parent = game.Workspace.Blocks
clone:SetPrimaryPartCFrame(CdaFrame)
end)
Thanks, JailBreaker_13

1 comment
I have the object (dirt) in replicated storage, no idea why it is erroring.