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

How do I make gamepasses work?

Asked by
Zwabb 0
10 years ago

I want to give a player dual illuminas when they have a gamepass. NOTE that I do not know one thing about scripts, so you have to tell me where I put the ID for the gamepass, and where I put the ID for the dual illuminas. Thanks!

2 answers

Log in to vote
0
Answered by 10 years ago

Next time please attempt to actually write the script, or at least look it up on the wiki. I will still answer this, however. (This is taken directly off the wiki)

local passId = 0000000 -- 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
        local dsw = game.ServerStorage.DualSwords:Clone()
        if plr:FindFirstChild("Backpack") then
            dsw.Parent = plr.Backpack
        end
        if plr:FindFirstChild("StarterGear") then
            dsw.Parent = plr.StarterGear
        end
    end
end)

So to make that work, you will have to get a model of the Dual Illuminas, place them into ServerStorage (Not StarterPack!) and then on line 9 you will have to change the name of the tool to DualSwords, or you could rename game.ServerStorage.DualSwords into whatever the model is called.

I hope I helped.

0
Ok it works, but when you die the swords get lost, and I don't want them lost. See, this is for a swordfighting game so this will need some kind of loop if I am correct? Zwabb 0 — 10y
0
I edited my answer. systematicaddict 295 — 10y
Ad
Log in to vote
0
Answered by 10 years ago
local passid = 168824527--CHAnge to game pass id
local tool = game.Lighting.Pistol--change to tool location in game(i.e.game.Lighting.AssaultRifle)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
    repeat wait(0.1) until player.Backpack  
    repeat wait(0.1) until player.StarterGear
    if GamePassService:PlayerHasPass(player, passid) then
        local tool1 = tool:Clone()
        local tool2 = tool:Clone()
        tool1.Parent = player.Backpack
        tool2.Parent = player.StarterGear
    end
end)
--put ur tools in lighting and anyone who has this pass will get that tool.

0
no losing when u die! fattyfateric1 0 — 10y

Answer this question