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

expected to close got eof?

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

1 comment

0

You need another end. Each if statement requires its own end.

1 answer

✓ Accepted answer

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

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