Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

my error is: Expected ')' (to close '(' at line 20), got <eof> how do i fix that?

-- Sprint Key Pressed
userInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		replicatedStorage.RemoteEvents.Sprint:FireServer("Began")
	end
end)

-- Sprint Key Released
userInputService.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		replicatedStorage.RemoteEvents.Sprint:FireServer("Ended")
	end
end)

-- Update Stamina GUI
replicatedStorage.RemoteEvents.StaminaUpdate.OnClientEvent:Connect(function(stamina, maxStamina)
	players.LocalPlayer.PlayerGui.Stamina.Bar.Size = UDim2.new((stamina / maxStamina) *  .971, 0,  .247, 0)
end


the error is : Expected ')' (to close '(' at line 20), got <eof> -

3 comments

0

18 end change to end) because you are in connect

0

lehoaiquoc248@ That's not quite the answer. The error indicates   an end is missing in  a function RBXScriptConnection . Function is the argument its taking, and requires an end) in line 20 . The error means that the end is unclosed to a function. :Connect has nothing to do with the error. 

0

:Connect doesn't return an end only functions like if statements, loops (exception of repeat loops)

1 answer

##Problem:

The error indicates that an end is missing from a function, and in this case, it'd be line 20, based on the error line.

##Information:

On line 20, there's no end) function to end the argument list of :Connect. The end) is a callback from the argument, since it ends that function with a closing parenthesis.

##Solution:

All you have to do is add an end) on line 20. Since that's where the error line in the output is stating.

##Fixed Script:

-- Sprint Key Pressed
userInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		replicatedStorage.RemoteEvents.Sprint:FireServer("Began")
	end
end)

-- Sprint Key Released
userInputService.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		replicatedStorage.RemoteEvents.Sprint:FireServer("Ended")
	end
end)

-- Update Stamina GUI
replicatedStorage.RemoteEvents.StaminaUpdate.OnClientEvent:Connect(function(stamina, maxStamina)
	players.LocalPlayer.PlayerGui.Stamina.Bar.Size = UDim2.new((stamina / maxStamina) *  .971, 0,  .247, 0)
end)

Reference:

RBXScriptConnection - API Documentation

####Any more edits are gonna be improvements on the wording of the answer.

1 comment

0

If you have more questions, feel free to post them here!

This discussion is preserved as it was. New answers, comments, and votes are closed.