local RunningSpeed = 20
local NormalSpeed = 10
local MaxStamina = 100
local StaminaDecrease = 0.4
local SprintKey = Enum.KeyCode.LeftShift
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Exterior = script.Parent.Exterior
local Bar = Exterior.Bar
local Sprinting = false
local StaminaAmount = MaxStamina
UserInputService.InputBegan:Connect(function(Key, Processed)
if not Processed then
if Key.KeyCode == SprintKey then
Sprinting = true
end
end
end)
UserInputService.InputEnded:Connect(function(Key, Processed)
if not Processed then
if Key.KeyCode == SprintKey then
Sprinting = false
end
end
end)
I cant figure out how to make this script work with a moble button. I tried to make a sepreate script were it would run when the button clicked but i think i did somthing wrong. This is the original script how can I make it work?