Hello my question is how would i code it for a player to spawn with a weapon only when they get teleported. i have the teleportation code already done and working and the code for the weapon being in their inventory when they spawn, put how would i get the weapon behind a gamepass?
local sword = game.ReplicatedStorage.Sword local newsword = sword:Clone() newsword.Parent = player.Backpack
that is my code for spawning with the weapon when teleported.
if game.GamePassService:PlayerHasPass(1279980489)then local sword = game.ReplicatedStorage.ThrowingChicken local newsword = sword:Clone() newsword.Parent = player.Backpack
i tried the code above to lock a weapon behind a gamepass but it will not work. any suggestions?
The PlayerHasPass function requires two arguments.
The first argument would be the player.
The second argument would be the passID
And you need to call the function correctly and with a colon and not with the dot operator.
Like:
if game:GetService("GamePassService"):PlayerHasPass(player, id) then -- Code here end