Made this awhile back and want to get started at making my own game. Idky my sprinting script aint working, but the gui is working which is great. If you can help, it would be greatly appreciated.
local CAS = game:GetService("ContextActionService")
local RE = game:GetService("ReplicatedStorage"):WaitForChild("RE")
local fill = script.Parent:WaitForChild("top"):WaitForChild("fill")
local stam = 50
local speed = 16
local sprinting = false
local function sprint (str,state,object)
if stam <1 then return end
speed = state == Enum.UserInputState.Begin and 24 or 16
sprinting = state == Enum.UserInputState.Begin
while sprinting and stam > 0 and wait(.1) do
stam = stam - 1
fill:TweenSize(UDim2.new(stam/50, 0, 1, 0),"Out","Quint", .1, true)
RE:FireServer('sprint', (speed))
end
sprinting = false
speed = 16
RE:FireServer('sprint', (speed))
wait(1)
while not sprinting and stam < 50 and wait (.5) do
fill:TweenSize(UDim2.new(stam/50, 0, 1, 0), "Out", "Quint", .1, true)
stam = stam +0.5
end
end
CAS:BindAction("sprint", sprint, true, Enum.KeyCode.LeftShift)
--sprinting does not work, but the gui is currently working when you hold down, and it also regens back.

2 comments
I feel like its the lines 11 and 12 that is making it not work, but I don't know. Any errors?
no errors, code went through well, just that when I press shift, im not running at all.