I made a gmae where you can buy speed for cash. You can buy speed, but if you die, your speed is set to 0. Also, if you leave, you walkspeed is reset. Here is my level 1 speed script:
local players = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function(Click) if players.leaderstats.Cash.Value >= 1 then players.leaderstats.Cash.Value -= 1 players.Character.Humanoid.WalkSpeed = 21 thews = 21 end end) players.CharacterAdded:Connect(function(c) c:WaitForChild("Humanoid").WalkSpeed = thews end) local players = game.Players.LocalPlayer script.Parent.TouchTap:Connect(function(Click) if players.leaderstats.Cash.Value >= 1 then players.leaderstats.Cash.Value -= 1 players.Character.Humanoid.WalkSpeed = 21 thews = 21 end end) players.CharacterAdded:Connect(function(c) c:WaitForChild("Humanoid").WalkSpeed = thews end)
Is there something I can add that makes this permanent if they buy this? All help is appreciated!
Use DataStores you can watch the tutorial or read the api https://developer.roblox.com/en-us/api-reference/class/DataStore https://www.youtube.com/watch?v=DkYupSBUpes