Once the player joins the game they have the X2 speed ability but once they die they lose it? I can't find a fix to this!? Any ideas why
Script in serverscriptservice
local MPS = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local SpeedX2_ID = 8291824
MPS.PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
if purchased and SpeedX2_ID == ido then
plr.Character.Humanoid.WalkSpeed.Value = plr.Character.Humanoid.WalkSpeed.Value * 2
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if MPS:UserOwnsGamePassAsync(plr.UserId,SpeedX2_ID) then
game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed = game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed * 2
end
end)

2 comments
wont work since plr will update as soon as someone new joins making this unreliable if i remember lua correctly, been doing javascript lately and thats how it works there at least
This means for EVERY player joined this code will run for THEM. So every time that SPECIFIC player dies, it should give them their speed.