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

'end' expected (to close 'while' at line 8) near '<eof>'??

I made a script that would play audio when "E" is pressed and I get this error whenever I load the game.

'end' expected (to close 'while' at line 8) near ''

Any ideas how to fix this? Here is the script

local Fireing = false
local IsEquipped = false
local Clicking = false

local MouseTarget = false

Mouse.KeyUp:connect(function(key) if key == "e" then
while IsEquipped == true do
if IsEquipped == true and Clicking==true then
game.Workspace.Sound:Play(821439273)

end

4 comments

0

Is this the whole script? If it is then, this isn't the script the error is coming from. It would come from line 113, but this script only has 26.

0

Sorry about that, edited it.

0

U need 2 ends at the bottom.

0

Now it says 'end' expected (to close 'if' at line 7) near ''

1 answer

✓ Accepted answer
local Fireing = false
local IsEquipped = false
local Clicking = false

local MouseTarget = false

Mouse.KeyUp:connect(function(key) if key == "e" then
while IsEquipped == true do
if IsEquipped == true and Clicking==true then
game.Workspace.Sound:Play(821439273)
end
end

You forgot to put the "end" of your while loop.

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