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

for alphawolvess ??/

Asked by 8 years ago
game.Players.PlayerAdded:connect(function(Player)
    if game:GetService("GamePassService"):PlayerHasPass(Player, 000) then
            game.ReplicatedStorage.Tool1:Clone().Parent = Player.StarterGear

    elseif game:GetService("GamePassService"):PlayerHasPass(Player, 000) then
            game.ReplicatedStorage.Tool2:Clone().Parent = Player.StarterGear

    elseif game:GetService("GamePassService"):PlayerHasPass(Player, 000) then
            game.ReplicatedStorage.Tool3:Clone().Parent = Player.StarterGear
    end
end)

2 answers

Log in to vote
1
Answered by 8 years ago

First I'll just tell you I don't script the same way you do, I prefer to not connect my events with a function above it.

Anyway, here is the script and look at commenting for explanations. The script bellow is on the basis of ROBLOX wiki.

local passId = 000 --ID Here
local passId2 = 0000 --Here too
local passId3 = 00000 -- Annnnd here

function isAuthenticated(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end
function isAuthenticated2(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId2)
end
function isAuthenticated3(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId3)
end

game.Players.PlayerAdded:connect(function(plr) -- plr = the added player
    if isAuthenticated(plr) then -- Seeing if they have the Pass
        game.ReplicatedStorage.RocketLauncher:Clone().Parent = Player.Backpack -- You should know this, you added it after all.
    end
        if isAuthenticated2(plr) then -- Seeing if they have the Pass
        --Code Here
    end
        if isAuthenticated3(plr) then -- Seeing if they have the Pass
        -- Code here
    end
end)

This will only give the player the rocket launcher once, along with other things for 2 and 3, depending on what you add.

Ad
Log in to vote
1
Answered by
peely09 15
8 years ago

I believe the problem may just be that the backpack is not yet loaded, as there doesn't seem to be any problem with the code.

I'd say try changing line 3 to:

game.ReplicatedStorage.RocketLauncher:Clone().Parent = Player:WaitForChild'Backpack'
0
this is a good diea my praises ConnorXV 5 — 8y

Answer this question