Hey there! I'm making a game where you can use knives. But there is one problem, when I clone the specified knife out of ReplicatedStorage, it breaks. The tool gets cloned whenever a TextButton is pressed. I'm not necessarily asking for a script, an explanation will do fine.
Any help is greatly appreciated!
The tool gets cloned whenever a TextButton is pressed. Sorry, I thought this meant that you already had a script. Since you don't already have a script, here is one that I tested using real quick:
function onClicked() local player = script.Parent.Parent.Parent.Parent local backpack = player:WaitForChild("Backpack") local cloneTool = game.ReplicatedStorage.Tool:Clone() cloneTool.Parent = backpack end script.Parent.MouseButton1Click:Connect(onClicked)
I did see that you said that you tried using a server script before and it didn't work - this is probably because you tried adding the tool to the backpack immediately, but you have to wait for the backpack to load in first otherwise it will not work (this is why it's good practice to use :WaitForChild()). There's probably a more efficient way to get the player, but what I did is I just kept on adding .Parent until I reached it. Hope this solves your problem.