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

Why does it say: 'end' expected (to close 'if' at line 3) near '< e o f >'?

Script:

while true do PBL = workspace.Sound.PlaybackLoudness if PBL + 100 then game.Workspace.BlueAndRed.BrickColor = BrickColor,Blue() if PBL + 600 then game.Workspace.BlueAndRed.BrickColor = BrickColor.Red()

end

For some reason it says:

Workspace.BlueAndRed.Script:7: 'end' expected (to close 'if' at line 3) near '< e o f >'

2 comments

1

You must close the "if" statements with "end"

0

if; then; statements always need an "end" at the end of the statements. ALWAYS.

2 answers

this is what you are trying to do

while true do  
    wait(0.1) -- make sure to add wait() to while true do or it will crash
local PBL = workspace.Sound.PlaybackLoudness -- add local   

if PBL == 100 then   -- you have to have == you can do if PBL + 100 == 101 then
    game.Workspace.BlueAndRed.BrickColor = BrickColor,Blue() 
end -- make sure you close if statement with end

if PBL == 600 then  
    game.Workspace.BlueAndRed.BrickColor = BrickColor.Red()
    
    end
end

2 comments

0

Does it have to stand in a local script?

0

what?

Thank you!

First of all, please marked as answered for this answer if it helped. If you are not the asker and this still helps and u have a similar question, upvote always works!

Code

-- Debugged by VVickedDev
--Created by jamielelystad
while true do  
    wait(0.1) 
PBL = workspace.Sound.PlaybackLoudness
if PBL + 99 >=100 then
    game.Workspace.BlueAndRed.BrickColor = BrickColor.Blue() 
end

if PBL + 599 >= 600 then  
    game.Workspace.BlueAndRed.BrickColor = BrickColor.Red()
	end
end

Good To Go!

Hope this script helped you better understand your errors in Roblox Lua! I hope you get successful some day with your game!

3 comments

0

Sadly does noting, thats for helping, you can aswell edit it if u see an problem in it, friend request me if you wanna see the game, thanks for helping, i'll look to other question about this!

0

edit: I can't see any errors, but doesn't do anything

0

game.Workspace.BlueAndRed.BrickColor = BrickColor.new("Really blue")

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