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

I am so confused with this MarketplaceService Help?

Asked by 5 years ago

I am making a speed gamepass script and found the gamepass script form roblox Developer Hub https://developer.roblox.com/en-us/articles/Game-Passes-One-Time-Purchases so i edited it for my needs to make the speed go faster but for some reason it never notices when the players character is added.

I'll show you what I did.

01local MarketplaceService = game:GetService("MarketplaceService")
02local Players = game:GetService("Players")
03 
04local SpeedPassID = 6810819  -- Change this to your game pass ID
05 
06Players.PlayerAdded:Connect(function(plr)
07 
08    local hasSpeedPass = false
09 
10    -- Check if the player already owns the game pass
11    local success, message = pcall(function()
12        hasSpeedPass = MarketplaceService:UserOwnsGamePassAsync(plr.UserId, SpeedPassID)
13    end)
14 
15    -- If there's an error, issue a warning and exit the function
View all 29 lines...

why is this not working and how can i fix?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I fixed it myself: like this instead

01local MarketplaceService = game:GetService("MarketplaceService")
02local Players = game:GetService("Players")
03 
04local SpeedPassID = 6810819  -- Change this to your game pass ID
05 
06Players.PlayerAdded:Connect(function(plr)
07 
08    plr.CharacterAdded:Connect(function(char)--broken?
09 
10 
11        local hasSpeedPass = false
12 
13        -- Check if the player already owns the game pass
14        local success, message = pcall(function()
15            hasSpeedPass = MarketplaceService:UserOwnsGamePassAsync(plr.UserId, SpeedPassID)
View all 33 lines...
Ad

Answer this question