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

Walkspeed gamepass not giving the player extra speed?

Asked by
Vid_eo 126
6 years ago
Edited 6 years ago

This walkspeed gamepass is not giving the player extra speed if owned. Here's my script:

01local passId = 4650300
02game.Players.PlayerAdded:connect(function(player)
03    local function isAuthenticated(player)
04       return game:GetService("GamePassService"):PlayerHasPass(player, passId)
05    end
06    print("i think it works")
07    if isAuthenticated(player) then
08        repeat wait() until player.Character.Humanoid
09        player.Character.Humanoid.WalkSpeed = 24---Change this line to what you want the Game Pass to do.
10        print("it does work!")
11    end
12end)

It prints "i think it works" but it doesn't print ("it does work")

Also, as an extra, how could I make it so that the player can buy the gamepass in game? Thanks.

1 answer

Log in to vote
0
Answered by 6 years ago
01local passId = 4650300
02local function isAuthenticated(player)
03    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
04end
05 
06game.Players.PlayerAdded:connect(function(plr)
07    if isAuthenticated(plr) then
08        repeat wait() until game.Players.LocalPlayer.Character.Humanoid
09        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 24
10    end
11end)

You should not have functions inside of the PlayerAdded event. Hopefully this works, I didn't try it though.

0
16:33:49.595 - GamePassId '4650300' is not of type Game Pass. Please use MarketplaceService:PlayerOwnsAsset instead. Vid_eo 126 — 6y
0
I replaced line 3 with return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId) and it still doesn't work Vid_eo 126 — 6y
0
That means you have the wrong ID of the Game Pass, or you have not created the Game Pass Creeperman1524 120 — 6y
Ad

Answer this question