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

Why does it say expected end to close function at line 5?

Asked by 5 years ago

****code = "testing" --type your code local gear = game.ReplicatedStorage:WaitForChild('Handgun') Input = script.Parent.Parent.CodeInput Output = script.Parent Output.MouseButton1Down:Connect(function() if Input.Text == code then gear:Clone().Parent = game.Players.LocalPlayer.Backpack gear:Clone().Parent = game.Players.LocalPlayer.StarterGear input.Text = 'Correct' wait (1) input.Text = 'Enter' else input.Text = 'Invalid/Used' wait (1) input.Text = 'Enter' end


thats my script i put and it says expected end to close function at line 5 tried couple times to fix but it ain't gonna fix.

0
Please put your code in a code block User#19524 175 — 5y
0
yea, also organize it, going for organization not space conservation theking48989987 2147 — 5y
0
Please use a code block. Also, it means you forgot an end. Add one accordingly. lunatic5 409 — 5y
0
--he tried-- greatneil80 2647 — 5y
View all comments (2 more)
0
I think your missing a “)” as well. Try “end)”. ABK2017 406 — 5y
0
If you're ending a function, then it's "end)", everything else is "end" Epuuc 74 — 5y

1 answer

Log in to vote
1
Answered by
Epuuc 74
5 years ago
code = "testing"
--type your code
local gear = game.ReplicatedStorage:WaitForChild('Handgun')
Input = script.Parent.Parent.CodeInput
Output = script.Parent 
Output.MouseButton1Down:Connect(function() 
    if Input.Text == code then 
        gear:Clone().Parent = game.Players.LocalPlayer.Backpack 
        gear:Clone().Parent = game.Players.LocalPlayer.StarterGear 
        input.Text = 'Correct' 
        wait (1) 
        input.Text = 'Enter' 
    else 
        input.Text = 'Invalid/Used' 
        wait (1)
        input.Text = 'Enter' 
    end
end)

You forgot to add the "end)" at the end of the code block.

0
woops i did try end) except my inputs are blue thats why i messed up thanks for the hlep HappyTimIsHim 652 — 5y
Ad

Answer this question