I'm sorry for the inconvenience, I have released I had many spelling errors, and other errors. I've fixed those mistakes, though there is still a problem. It says that I need to close my function on line 32... I did..? Btw, I changed the localscript below.
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) local players = game:GetService("Players") local inputService = game:GetService("UserInputService") local player = players.LocalPlayer local character = playerCharacter or player.CharacterAdded:wait() local humanoid = character:WaitForChild("Humanoid") local stamina = 100 local Interface = {} do local playerGui = player:WaitForChild("PlayerGui") local gui = playerGui:WaitForChild("Stamina") local frame = gui:WaitForChild("Frame") local textlabel = frame:WaitForChild("TextLabel") local bar = frame:WaitForChild("Percentage") local UDim2_new = UDim2.new function Interface:UpdateStamina() bar.Size = UDim2_new(stamina/100, 0, 0, 0) textLabel.Text = ("Stamina - 4d / 100")format(stamina) end end inputService.InputBegan:connect(function(input, event) if (event or stamina <= 0) then return end local key = input.KeyCode.Name print(key) if (key == "LeftControl") then humanoid.Walkspeed = 26 repeat if (humanoid.MoveDirection.Magnitude > 0.1) then stamina = stamina - 1 Interface:UpdateStamina() end wait(0) until not inputService:IsKeyDown(Enum.KeyCode.LeftControl) do humanoid.WalkSpeed = script.Parent.Parent.Humanoid.Walkspeed if (stamina <= 0) then wait(3) else wait(1) end while (not inputService:isKeyDown(Enum.KeyCode.LeftControl)and stamina >= 100) do stamina = stamina + 0.1 Interface:UpdateStamina() wait(0) end end end
"Expected '(', '{' or <string> got 'local'" says to me that it's a syntax error. I looked at the line before and spotted something that would confuse the heck out of lua.
You have a colon on line six, so lua thinks you're calling a method or something and is expecting a parameter
or just ()
.
Replace the :
with a .
on line six and you'll be just fine!
EDIT:
Looking at your new problem, you should just add an end)
to end the anonymous function at line 32.
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) local players = game:GetService("Players") local inputService = game:GetService("UserInputService") local player = players.LocalPlayer local character = playerCharacter or player.CharacterAdded:wait() local humanoid = character:WaitForChild("Humanoid") local stamina = 100 local Interface = {} do local playerGui = player:WaitForChild("PlayerGui") local gui = playerGui:WaitForChild("Stamina") local frame = gui:WaitForChild("Frame") local textlabel = frame:WaitForChild("TextLabel") local bar = frame:WaitForChild("Percentage") local UDim2_new = UDim2.new function Interface:UpdateStamina() bar.Size = UDim2_new(stamina/100, 0, 0, 0) textLabel.Text = ("Stamina - 4d / 100")format(stamina) end end inputService.InputBegan:connect(function(input, event) if (event or stamina <= 0) then return end local key = input.KeyCode.Name print(key) if (key == "LeftControl") then humanoid.Walkspeed = 26 repeat if (humanoid.MoveDirection.Magnitude > 0.1) then stamina = stamina - 1 Interface:UpdateStamina() end wait(0) until not inputService:IsKeyDown(Enum.KeyCode.LeftControl) do humanoid.WalkSpeed = script.Parent.Parent.Humanoid.Walkspeed if (stamina <= 0) then wait(3) else wait(1) end while (not inputService:isKeyDown(Enum.KeyCode.LeftControl)and stamina >= 100) do stamina = stamina + 0.1 Interface:UpdateStamina() wait(0) end end end end)