Button that gives tool works fine but stops working when I add "Clone()" at the end of the variable?
So I managed to make the button that gives the tool but now I want it to give infinite amount so it doesn't just work once.
That's why I added "Clone()" at the end of the tool variable but it doesn't work when I add that.
LocalScript {inside textbutton inside frame inside screengui}:
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
3 | local GiveRemoteMine = ReplicatedStorage:WaitForChild( "GiveRemoteMine" ) |
4 | local tool = game.ReplicatedStorage.Tools.RemoteMine:Clone() |
5 | GiveRemoteMine:FireServer(tool) |
ServerScript {inside folder inside workspace}:
1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 | local GiveRemoteMine = ReplicatedStorage:WaitForChild( "GiveRemoteMine" ) |
4 | GiveRemoteMine.OnServerEvent:Connect( function (player, tool) |
5 | tool.Parent = player.Backpack |
If you add ":Clone()" at the end of the "local tool" variable inside LocalScript for some reason everything stops working. And when I get rid of the "Clone()" all of a sudden it starts working but it only gives you one of the tool and then the button is just useless.
If someone could help me and tell me how to clone it so the button gives you infinite amount of that tool that'd be awesome!