Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

local MPS = game:GetService('MarketplaceService')
local Player = game.Players.LocalPlayer

if MPS:UserOwnsGamepassAsync(Player.UserId, 0) then -- change 0 to GamepassId.
	-- code here
end

2 comments

0

didn't work

0

Have you defined Player?

This discussion is preserved as it was. New answers, comments, and votes are closed.