Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
2I_k 0
3 years ago
Edited by JesseSong 3 years ago
-- 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> -

0
18 end change to end) because you are in connect lehoaiquoc248 23 — 3y
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.  JesseSong 3916 — 3y
0
:Connect doesn't return an end only functions like if statements, loops (exception of repeat loops) JesseSong 3916 — 3y

1 answer

Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
3 years ago
Edited 2 years ago

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. Theend) 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.

0
If you have more questions, feel free to post them here! JesseSong 3916 — 3y
Ad

Answer this question