Tool breaks after clone

hello, I have a sorta big problem with my game. I am making a tool giver GUI and whenever I clone the weapon, which is in replicated storage, none of the scripts work. the link to the weapon is “2021 FE Melee Kit [v1.2.13] - Roblox”. any help

1 Like

Because the scripts already ran and no-point putting Server-sided scripts in replicated storage Instead put the tool ina Folder in ServerStorage and call it from there.

1 Like

I tried to put the tool in server storage and it can’t find the weapon. the output says “Axe is not a valid member of ServerStorage”. btw I am using a local script in a GUI button. I tried a server script. didn’t work.

Then use WaitForChild(“-- the name of your tool.”)

i used that but now the output says " Infinite yield possible on 'ServerStorage:WaitForChild(“Axe”)"

You cannot clone tools locally. You need to do this in a server script, a regular script if you will. This is because of FE and it will not replicate to the server if you clone it on the client, hence why the scripts inside the tool don’t run. Make a new script, clone the tool inside the server script, and parent it to the specific players backpack. Let me know if you have questions.

LocalScripts can’t do anything with the server. LocalScripts are for the client, and the client can’t see the contents of ServerStorage.

but how will i access the local player’s backpack if i use a client script

you can fire a remote event I think

When you call back a remote event, you can find the player by doing

game.ReplicatedStorage.(Event).OnServerEvent:Connect(function(Player)
game.ServerStorage.Axe:Clone().Parent = Player.Backpack
end)
Hopefully this helps

Also to call a remote event on a client do game.ReplicatedStorage.(Event):FireServer()

The Callback function goes in ServerScriptService btw

If you have any issues please let me know what is put into the Output

1 Like

it Tool.Archivable set to true? without it the tool cannot be cloned

@SupremeSuperSoCool You must use a script while cloning the tool. If you use local script, it might break. So, try cloning it with a script.

Hope it helps.

this is very old by now but in case anybody needed the solution, I used prints and found that if you have the character in one of the client scripts inside the tool defined as “player.CharacerAdded:Wait()” then you should change it to “player.Character” since by the time that the tool is given to the player, their character has already been loaded so the wait will be infinite

I tried this in the first place because I had the same problem with my weapons system in one of my places

3 Likes

I know this is an old topic but i will give the solution.

So you need to create A remote event at the RepStorage.

LocalScript from the button:

script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireServer() -- fire the remote event
end)

ServerScript:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) -- Grab the player who clicked the button
	game.ReplicatedStorage.Tool:Clone().Parent = player.Backpack -- gives the the tool to the player 
end)

This should be working.

3 Likes

YO This is what I needed thanks Lotalunic lets go

2 Likes