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

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

Asked by 10 years ago

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)
0
What do you mean "more than once"? ultimate055 150 — 10y
0
The tool is not given everytime the players die and respawn rollercoaster57 65 — 10y

Locked by adark and Shawnyg

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 10 years ago

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!
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. rollercoaster57 65 — 10y
0
No problem! TheDarkOrganism 173 — 10y
Ad