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

Spawning with weapons in specific areas?

Asked by 6 years ago

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?

1 answer

Log in to vote
1
Answered by 6 years ago

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
0
Thank you so much!! deathrazor36 -5 — 6y
Ad

Answer this question