Hello everyone.
I’m trying to find a way to clone a log (tool) into the workspace from server storage. Not sure if I’m missing something or I did something wrong, and I’m getting really confused.
local serverStorage = game:GetService("ServerStorage")
local log = serverStorage.Resources.Log
local logCopy
script.Parent.Touched:Connect(function(obj)
if obj.Name == ("Handle") then
script.Parent.Anchored = false
task.wait(2)
logCopy = log:Clone()
logCopy.Handle.Position = script.Parent.Position
logCopy.Parent = game.Workspace
script.Parent:Destroy()
end
end)
This is odd, both you and @Pegagittt scripts worked, it’s just not cloning in the right position. I’m trying to make a tree fall down when an axe hits it, and clone it which has worked as I said but it’s not cloning where the tree is.
You should consider defining logCopy inside the function instead of outside of it, otherwise you may accidentally share the same instance between several function calls which could cause unexpected behavior, especially since you have a wait().
Yeah, it said CanCollide is not a valid member of tool workspace.Log or something like that, and also the tree did not destroy itself and the log just started multiplying. Not sure what happened there. It did clone in the right spot so that’s better than nothing.