Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I have a player be awarded a tool more then once through a gamepass?

I need to know this, because my current code only awards the gun once. How could I change this to work that way?

local passId = 168101268 -- change this to your game pass ID.
function isAuthenticated(player) -- checks to see if the player owns your pass
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
	wait (10)
local permpack = plr.Backpack
local turretgun = game.Lighting.Turret:clone()
turretgun.Parent = permpack
    end
end)

2 comments

0

What do you mean "more than once"?

0

The tool is not given everytime the players die and respawn

1 answer

✓ Accepted answer

This should fix your problem:

local passId = 168101268 -- change this to your game pass ID.
function isAuthenticated(player) -- checks to see if the player owns your pass
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
    wait (10)
local permpack = plr.Backpack
local starteritem = plr.StarterGear
local turretgun = game.Lighting.Turret:clone()
turretgun.Parent = permpack
turretgun.Parent = starteritem
    end
end)

You should check this for extra help and to learn how to make things stay with the player!

  • I hope this helps!

2 comments

0

Thank you, I knew there was a starter somethin g in the player, but I could never figure it out now that my game is to big to run both client and server programs, thank you! I am very thankful.

0

No problem!

This discussion is preserved as it was. New answers, comments, and votes are closed.