Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Give Weapons To all Players?

Asked by
GentiRob -81
5 years ago

So I have All Code Ready, The Teleport and everything works, I want to Do When They Teleport, They Get A Gun, Which in my case is a RPG, Please Help Thanks!

0
Do you want all players that join the game or all players in the game at one specific time? rokedev 71 — 5y
0
At One Specified time GentiRob -81 — 5y

2 answers

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago

If you want all players to get a gun when they teleport, all you would need to do is clone the RPG from storage into the player's backpack just after they teleport.

Here's an example of how to do that: (this is unusable until you change the hierarchy to match yours)

local rpg = RPG:Clone()
rpg.Parent = player

If this answers your question, then mark it as the accepted answer.

0
You are parenting the cloned rpg to the player not the backpack of the player. xPolarium 1388 — 5y
0
Assuming 'player' is the player instance. xPolarium 1388 — 5y
Ad
Log in to vote
0
Answered by
Imperialy 149
5 years ago
local replicatedstorage = game:GetService("ReplicatedStorage")
local tool = replicatedstorage:WaitForChild("Gun") -- change "Gun" to the weapons name
local cangive = false
game.Players.PlayerAdded:Connect(function(player)
    if cangive then
        tool:Clone().Parent = player:WaitForChild("Backpack")
        tool:Clone().Parent = player:WaitForChild("StarterGear") -- they spawn with it
    end
end)

make a statement in your script where it turns 'cangive' to true

Answer this question