How to make players receive tools

Okay so I am trying to make a System where the players receive’s a tool when the round starts.

local Storage = game:GetService("ReplicatedStorage")
-- Abilities
local Push = Storage:WaitForChild("Push")
local Punch = Storage:WaitForChild("Punch")
local SuckerPunch = Storage:WaitForChild("Sucker Punch") 
-- leaderstats
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local leaderstats = Player:WaitForChild("leaderstats")
local Rank = leaderstats:WaitForChild("Rank")

function Give(Name)
	local Tool = Storage:FindFirstChild(Name)
	if Tool then
		Tool:Clone().Parent = Player.Backpack
	end
end

while true do
	Give(Push)


	if Rank.Value > 9 then 
		Give(Punch)
	end
	
	if Rank.Value > 19 then
		Give(SuckerPunch)
	end
	task.wait(119)
	task.wait(14)
end
Error

Just doesn’t do anything

1 Like

Check if your local script is enabled and where is it parented? And check if the instances you’re trying to access like leaderstats or push actually exist.

Even if the script did work it wouldn’t really since you’re giving the player’s backpack a tool on the client side. So other players won’t see the tool.

You should be doing this in a server script. Then Loop through every player object in game.Players:GetPlayers() and then run your functions like push.

1 Like

Its parented to StarterCharecterScripts and yes Push and Rank do exist

1 Like

oh, in the ‘Give()’ function, the name should be a string:

Give(Push) -- ❌
Give("Push") -- ✅

btw if this didn’t give you any error, you should really do what @Amritss told you.

edit: why do you set ‘Push’, ‘Punch’ and ‘SuckerPunch’ variables if you don’t use them?

2 Likes

Oh thanks so much. It works!

I do have another problem if someone could help. Gui Reseting

Are you sure other players can actually see the tools though?? When a player is holding it for example?

Yeah, this may be an issue because you’re giving the tools via player, so what happens is that: Your player can see it but the others don’t because the server can’t see the tool because you used LocalScript.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.