I have a dev product that temporarily gives you a speed boost. My problem is that when you die your speed goes back to normal. How can I fix this? Heres the if statement for the devproduct:
if receiptInfo.ProductId == 1289737124 then print("player bought 30sec speed boost") player.Character.Humanoid.WalkSpeed = 40 for i = 30, 1, -1 do -- sets 30 second timer gui.Text = tostring(i) wait(1) end player.Character.Humanoid.WalkSpeed = 16 end
A simple way to fix this would be to update the player's walkspeed every time the loop ticks as so:
if receiptInfo.ProductId == 1289737124 then print("player bought 30sec speed boost") player.Character.Humanoid.WalkSpeed = 40 for i = 30, 1, -1 do -- sets 30 second timer gui.Text = tostring(I) player.Character.Humanoid.WalkSpeed = 40 --Update the speed every second wait(1) end player.Character.Humanoid.WalkSpeed = 16 end
So if the player dies, their speed will still be boosted within a second