Hey,
I wanted to make a system that clones a random tool from a folder.
The tool is cloning fine with the handle but scripts and animations etc. are not working.
The children variable is a folder that contains the players Models.
It is giving this error:
ServerScriptService.MapTpSystem:74: attempt to call a nil
I hope anyone can help.
local toolFolder = game.ReplicatedStorage.SavingTools.Swords
local tools = toolFolder:GetChildren()
local children = workspace.InGame:GetChildren()
for i = 1, #children do
local tool = tools[math.random(1, #tools)]:GetChildren():Clone()
tool.Parent = children[i]
end
So I think your issue is with this line right here:
It seems to me that you’re cloning a table and then trying to set the tables parent to the player. I believe that if you changed it to this, it should work as you want.
local tool = tools[math.random(1, #tools)]:Clone()
So it clones perfectly now because i fixed another error but im now getting this error.
ServerScriptService.MapTpSystem:74: attempt to call a nil value
So youre correct.
I tested it out a few timesnow but now its cloning the tool with no error but also without the children.
It keeps the handle but no scripts are working.