Speed Gamepass resets whenever the player dies even though I made sure to make it active again once they die?!
ServerScript
local MPS = game:GetService("MarketplaceService")
MPS.PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
if purchased and 8946555 == ido then
plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed * 2
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if MPS:UserOwnsGamePassAsync(plr.UserId,8946555) then
game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed = game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed * 2
end
plr.Character:FindFirstChild("Humanoid").Died:Connect(function()
wait(6)
if MPS:UserOwnsGamePassAsync(plr.UserId,8946555) then
game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed = game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed * 2
end
end)
end)
game.ReplicatedStorage.Speed.OnServerEvent:Connect(function(plr)
plr.Character:WaitForChild("Humanoid").WalkSpeed = plr.Character:WaitForChild("Humanoid").WalkSpeed * 2
end)
PrompPurchase
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local GamepassID = 8946601 -- Change this to your developer product ID
-- Function to prompt purchase of the developer product
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptGamePassPurchase(game.Players.LocalPlayer, GamepassID)
end)
MarketplaceService.PromptGamePassPurchaseFinished:connect(function(player, id, purchased)
if id == GamepassID and purchased then
game.ReplicatedStorage.VIP:FireServer()
end
end)

2 comments
I'm using a serverscript? How would I get .LocalPlayer
you can't use .LocalPlayer inside of a normal script, there are other ways to do it instead