Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Help with cloning?

Asked by 9 years ago

My script does not work. It doesn't clone. Can someone help me?

g = game.Lighting.Tool
g:Clone()
g.Parent = game.workspace
game.workspace.killekill29.Humanoid:EquipTool(g)

1 answer

Log in to vote
1
Answered by 9 years ago

You are calling the :Clone method incorrectly, it is only Cloning the Tool and setting it's Parent to nil, while the original game.Lighting.Tool's Parent is being set to the Workspace, also, when your script executes, Tool may not be existant in Lighting, this can be fixed by switching :Clone to g on line 1, and adding WaitForChild on line 1 aswell, last but not least, this is a problem with line 4, where you are attempting to call killekill29 and Humanoid, again, these may not be existant when the code executes, let's fix up your code;

g = game.Lighting:WaitForChild("Tool"):Clone() --Surprised much? This will wait until 'Tool' has spawned, before executing the code, and calls 'Clone' on it
g.Parent = game.Workspace --Set's the Cloned Tool's Parent to the 'Workspace'
game.Workspace:WaitForChild("killekill29"):WaitForChild("Humanoid"):EquipTool(g) --You will now be equipped with the Tool, I guess? :P Again, 'WaitForChild' is being called to wait before equipping the 'Tool' to the Player

Hope this helped!

Ad

Answer this question