It keeps getting error..it needs to be when they touch it, it will give them a random weapon out of server storage
RespawnTime = 1200
Debounce = false
script.Parent.Touched:connect(function (Hit)
local HumanoidIsFound = Hit.Parent:FindFirstChild("Humanoid")
local PlayerIsFound = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Hit.Parent and HumanoidIsFound and HumanoidIsFound.Health > 0 and PlayerIsFound then
if not Debounce then
Debounce = true
local Weapon = (game.ServerStorage:GetChildren())[math.random(1,NumWeapons)]
if Weapon then
local newWeapon = Weapon:Clone()
newWeapon.Parent = PlayerIsFound.Backpack
else
Debounce = false
return
end
wait(RespawnTime)
Debounce = false
end
end
end)

4 comments
What's the error? .-. Don't just say "there's an error" and not give it. It's probably because "NumWeapons" doesn't exist and that it should be "#NumWeapons" if it did exist.
how do i make it exist?
Create a variable for it.
Add it into the script. Make a table called NumWeapons, which is equal to 'ServerStorage:GetChildren()'