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:

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

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
local passId = 4650300
local function isAuthenticated(player)
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
        repeat wait() until game.Players.LocalPlayer.Character.Humanoid
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 24
    end
end)

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