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

expected to close got eof?

Asked by 3 years ago

Im trying to make something that a script in a a teleporter will only work when someone does a certain thing, then I tested, opened output, then found this error, can someone please help me out.

Script:

local part = script.Parent

if game.PurpleKey.ClickDetector.MouseClick:Connect(function(plr) keyModule.Clicked = true wait(1) part:remove()

if game.PurpleKey.ClickDetector.MouseClick:Connect(function(plr) keyModule.Clicked = false wait(1) part:add()

end

0
You need another end. Each if statement requires its own end. JigglyWiggles 15 — 3y

1 answer

Log in to vote
0
Answered by
nc2r 117
3 years ago
Edited 3 years ago

It was a simple syntax error

local part = script.Parent

if game.PurpleKey.ClickDetector.MouseClick:Connect(function(plr) keyModule.Clicked = true wait(1) part:remove()

if game.PurpleKey.ClickDetector.MouseClick:Connect(function(plr) keyModule.Clicked = false wait(1) part:add()

end
end
Ad

Answer this question