So, I'm not a pro at scripiting and this is the first time in using a random function thing for my games, I'm want to make 1 of the 5 guns i have randomly spawn in a players backpack when he respawns.... How would I do that..
✓ ANSWER ACCEPTED
A random gun spawn?
1 answer
✓ Accepted answer
First you would want to use the PlayerAdded event to connect to a player, and identify if they have respawned or not. You can use the CharacterAdded event to do so. Then you would want to use the math.random function to index a tool in storage and parent it to the spawning player's backpack.
Unless you provide attempt for a script, I can not help all that much or else you would not be benefiting from attempting it. I will help you set up the functions though real quick.
game.Players.PlayerAdded:connect(function(plr) --So a player was added, and we're calling him player.
plr.CharacterAdded:connect(function() --This sill fire the function if the player respawns.
--You must finish the rest of the code here, post a new question if you have difficulty getting something to work.
end) --End the CharacterAdded function.
end) --We'll end the function for PlayerAdded.
Once again, we can not help you unless you make a attempt at a script. Thank you for your understanding.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Yeah now I got a basic idea what how to make my script so now I'll try...
It works!! Thank you!!