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

Speed Gamepass that works when i join but not when i buy walkspeed?

Asked by 4 years ago
Edited 4 years ago

I made a script that gives the player 1.5x walkspeed. It works when the player joins but when the player enter the shop i made where you can buy more walkspeed then right after it goes back to the normal speed. The speed the player bought. I want it to stack the players speed 1.5x also when he bought walkspeed.

Works when the player buys the gamepass and when the player joins the game, but doesn't work if the player buy for example. +25 walkspeed

This is the script for the gamepass

local id = 8350199 -- Change To Your Gamepass ID

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
    if purchased and ido == id then
        plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed*1.5
    end
end)

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
            char.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed*1.5
        end
    end)
end)

A gyazo that shows the shop even tho you probably don't need it: https://gyazo.com/83496f3b66d81b3cab24d137e5c0841f

0
The screenshot does not give any additional information at all. Also, please work on the grammar of your question, as it is hard to read and understand effectively. appxritixn 2235 — 4y
0
Another thing, can you provide the code for the shop? appxritixn 2235 — 4y

Answer this question