How to change a players move speed through a button script

how to change a players movespeed when a player clicks a textbutton / imagebutton (with a lcoalscript)? I need help with this because this will be useful.

You mean like they press a text button to increase speed and another button to decrease speed?
Local Script

local player = game.Players.LocalPlayer

local IncreaseButton = --define text button here

local DecreaseButton = --define here

IncreaseButton.Activated:Connect(function()
      local character = player.Character or player.CharacterAdded:Wait()
      character.Humanoid.WalkSpeed = character.Humanoid.WalkSpeed + 1
end)

DecreaseButton.Activated:Connect(function()
      local character = player.Character or player.CharacterAdded:Wait()
      character.Humanoid.WalkSpeed = character.Humanoid.WalkSpeed - 1
end)
2 Likes