Simplified version on how my latest Round-Based-Game’s activation process is supposed to work:
The round is activated by a value named “ISROUNDPLAYING”. I’m trying to get this music script to work so 1 song will play for 70 seconds and the other for 30 seconds when “ISROUNDPLAYING” = 1 (1 means the round is active).
The script should work fine, it looks functional but oddly enough the = sign is counted as an error. What can I do to fix this?
Here is my current script:
if game.Workspace.VALUES.ISROUNDPLAYING.Value = 1 (<The error is right here<) then
script.Parent.Corridor.Playing = true
wait(70)
script.Parent.Corridor.Playing = false
script.Parent.Intensity.Playing = true
wait(30)
script.Parent.Intensity.false
end
if game.Workspace.VALUES.ISROUNDPLAYING.Value = 1 (<The error is right here<)
script.Parent.Corridor.Playing = true
wait(70)
script.Parent.Corridor.Playing = false
script.Parent.Intensity.Playing = true
wait(30)
script.Parent.Intensity.false
end
else
script.Disabled = true
end
Four major errors you’ve done here:
You’ve used two end statements so no wonder the script doesn’t work. Line 8 to be precise is where the error is.
Script.Parent.Intensity.false is not actually operable. Its still waiting for you to do something to it.
You shouldn’t store your ISROUNDPLAYING values in the workspace, a server side script which is your game server would be better to store this as you can call it in events.
Your setting a value on your first line which isn’t correct, use == instead to compare the arguments (in this case its asking if they are equal). If you don’t have any afterwards then you are checking if the object exists and if it has a boolean value related to it then it gives the response.
Just saying if you indent your code it can be easier to notice these mistakes easier as then it gives your code structure and things become more noticeable. (Hint: If you use ``` in this hypertext you can get lua code automatically formatted like in studio.