Sprint Button
LocalScript
local button = script.Parent
local Player = game:GetService('Players')
local sprinting = false
local function sprint()
local player = Player.LocalPlayer
if sprinting then
sprinting = false
button.Text = 'Sprint: Off'
player.Character.Humanoid.WalkSpeed = 16
else
sprinting = true
button.Text = 'Sprint: On'
player.Character.Humanoid.WalkSpeed = 50
end
end
button.MouseButton1Click:Connect(sprint)
Hold Button to Sprint
local button = script.Parent
local Player = game:GetService('Players')
local function sprint()
local player = Player.LocalPlayer
button.Text = 'Sprint: On'
player.Character.Humanoid.WalkSpeed = 50
end
local function walk()
local player = Player.LocalPlayer
button.Text = 'Sprint: Off'
player.Character.Humanoid.WalkSpeed = 16
end
button.MouseButton1Down:Connect(sprint)
button.MouseButton1Up:Connect(walk)