I wanted to make a shop, that if I click on buy, it will sent the player into the buying screen and when its bought, he is walking faster, but when he respawns, he loses his faster walk. Please help me!
local Marketplace = game:GetService("MarketplaceService") local Player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() Marketplace:PromptGamePassPurchase(Player, 9586786) end) Marketplace.PromptGamePassPurchaseFinished:Connect(function(purchased) if purchased then Player.Character.Humanoid.WalkSpeed = 40 end end) game.Players.PlayerAdded:Connect(function(plr) if Marketplace:UserOwnsGamePassAsync(Player.UserID, 9586786) then Player.Character.Humanoid.WalkSpeed = 40 end end) game.Players.PlayerAdded:Connect(function(plr) if Marketplace:UserOwnsGamePassAsync(Player.UserID, 9586786) then Player.Character.Humanoid.WalkSpeed = 40 end end) local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) if Marketplace:UserOwnsGamePassAsync(Player.UserID, 9586786) then Playerz.Character.Humanoid.WalkSpeed = 40 end end) end
local id = YOUR_ID_HERE game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased) if purchased and ido == id then plr.Character.Humanoid.WalkSpeed = 30 --player walk speed (change if you want it higher 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 = 30 end end) end) --Make a gamepass and copy and paste ID into the top
Try this, it should prompt them to buy a speed gamepass then give them speed
Could it be because of your connection? If yes then instead of CharacterLoaded use CharacterAppearanceLoaded as it's better.