Hello! I have made a shop with a "SpeedBoost button" taht works perfectly but when you buy it it affects all players in the game, it also resetts when the player dies. Can anyone help?
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character.Humanoid
game.ReplicatedStorage.ToolEvents.SpeedBoostEvent.OnServerEvent:Connect(function(player)
if player.leaderstats.Coins.Value >= 1500 then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - 1500
--game.ServerStorage.Tools.JumpBoost:Clone().Parent = player.Backpack
humanoid.WalkSpeed = 24
end
end)
end)
end)

4 comments
Try firing the speedboost on a localscript instead.
Use a local script. It will only affect the person who clicked it. And then when the player dies, just save their walk speed before death and set it again when they respawn.
Wouldn't taht only make it appear for the client?
and if i do ho do i make it work in the local script