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

How can i turn my script so it works only when i own an gamepass?

Asked by 4 years ago
local Humanoid = script.Parent.Humanoid
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
if tag ~= nil then 
if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") 
if Leaderstats ~= nil then 
Leaderstats.Points.Value = Leaderstats.Points.Value + 50
wait(0.1) 
script:remove() 
end 
end 
end 
end 
Humanoid.Died:connect(PwntX_X) 

How can I turn my script so it works only when I own a game pass?

This script goes in the StarterCharacterScripts folder...

1 answer

Log in to vote
1
Answered by
pwx 1581 Moderation Voter
4 years ago
Edited 4 years ago
local MPS = game:GetService('MarketplaceService')
local Player = game.Players.LocalPlayer

if MPS:UserOwnsGamepassAsync(Player.UserId, 0) then -- change 0 to GamepassId.
    -- code here
end
0
didn't work itadakimasu_Kurepu 29 — 4y
0
Have you defined Player? pwx 1581 — 4y
Ad

Answer this question