Hello, recently I got another bug in one of my scripts, and I was wondering if anybody could fix the issue, the script is below.
if game.StarterGui.OofSounds.AllOofSoundsLeft.Oof.Oof.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof"
wait(0.5)
script.Parent.CurrentSound.Text = "Currently Playing:"
else
if game.StarterGui.OofSounds.AllOofSoundsLeft.OOF.OOF.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: OOF"
wait(1.2)
script.Parent.CurrentSound.Text = "Currently Playing:"
else
if game.StarterGui.OofSounds.AllOofSoundsLeft.OofEchoed.OofEchoed.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof (Echoed)"
wait(2.7)
script.Parent.CurrentSound.Text = "Currently Playing:"
else
if game.StarterGui.OofSounds.AllOofSoundsLeft.LoudOof.LoudOof.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Loud Oof"
wait(8.3)
script.Parent.CurrentSound.Text = "Currently Playing:"
else
if game.StarterGui.OofSounds.AllOofSoundsLeft.OofMusic.OofMusic.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof Music"
wait(204)
script.Parent.CurrentSound.Text = "Currently Playing:"
else
if game.StarterGui.OofSounds.AllOofSoundsLeft.OofAstromania.OofAstromania.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof Astromania"
wait(67)
script.Parent.CurrentSound.Text = "Currently Playing:"
else
if game.StarterGui.OofSounds.AllOofSoundsLeft.OofLasagna.OofLasagna.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof Lasagna"
wait(130)
script.Parent.CurrentSound.Text = "Currently Playing:"
end
end
end
end
end
end
end
If anybody manages to fix the issue within my script, well done, and I will then mark your reply as solved.
Xemptia
(Xemptia)
August 2, 2020, 5:44pm
2
Can you state what the bug is or what shows in output?
1 Like
There is no output of the error in the console log.
Xemptia
(Xemptia)
August 2, 2020, 5:47pm
4
What exactly are you trying to do in your script though?
Iâm trying to make it so if you play a sound the text above it will say like âCurrently Playing: insert sound here â
Xemptia
(Xemptia)
August 2, 2020, 5:50pm
6
The indentions are kind of confusing to me but I do notice that you have an if statement under each of the if statement I donât know if you can do that or if you can I forgot
Are you talking about putting else and if together?
QUlCKRED
(QUlCKRED)
August 2, 2020, 5:59pm
8
Hm⌠Try doing that âelseifâ.
Nope
if game.StarterGui.OofSounds.AllOofSoundsLeft.Oof.Oof.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof"
wait(0.5)
script.Parent.CurrentSound.Text = "Currently Playing:"
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OOF.OOF.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: OOF"
wait(1.2)
script.Parent.CurrentSound.Text = "Currently Playing:"
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofEchoed.OofEchoed.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof (Echoed)"
wait(2.7)
script.Parent.CurrentSound.Text = "Currently Playing:"
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.LoudOof.LoudOof.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Loud Oof"
wait(8.3)
script.Parent.CurrentSound.Text = "Currently Playing:"
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofMusic.OofMusic.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof Music"
wait(204)
script.Parent.CurrentSound.Text = "Currently Playing:"
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofAstromania.OofAstromania.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof Astromania"
wait(67)
script.Parent.CurrentSound.Text = "Currently Playing:"
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofLasagna.OofLasagna.Playing == true then
script.Parent.CurrentSound.Text = "Currently Playing: Oof Lasagna"
wait(130)
script.Parent.CurrentSound.Text = "Currently Playing:"
end)
Tried that, the ) is marked with a red underline under it.
Indicating that it makes an error if you do it.
QUlCKRED
(QUlCKRED)
August 2, 2020, 6:08pm
12
Yes, remove the ). Does it work?
Already tried, it doesnât work still.
MarkiPr0
(Marki)
August 2, 2020, 6:10pm
14
The problem should be in the first line, when the game starts, everything from StarterGui gets moved to the PlayerGui.
So a way to fixing your problem would be:
local PlayerGui = game:GetService("Players").LocalPlayer:WaitForChild()
if PlayerGui:WaitForChild("OofSounds"):WaitForChild("AllOofSoundsLeft")WaitForChild("OOF"):WaitForChild("OOF"):WaitForChild("Playing") == true then
-- REST
And instead of else if, do elseif, and also fix your indents please.
If you wanna test this, this should be a LocalScript , and not a Server Script (Script) as LocalPlayer cannot be accessed on the server.
This change will only replicate to the client, and if you would want it to replicate to all clients, you should use Remote Events .
There are a lot more issues that people above already mentioned.
Moonvane
(Moonvane)
August 2, 2020, 6:12pm
15
i see what you are trying to do here, but i highly recommend you do this instead:
local function findPlayingSound()
for _, v in pairs(game.StarterGui.OofSounds.AllOofSoundsLeft:GetDescendants()) do
if v:IsA("Sound") and v.IsPlaying then
return v
end
end
end
local firstPlayingSound = findPlayingSound()
script.Parent.CurrentSound.Text = "Currently Playing: " .. firstPlayingSound.Name
wait(firstPlayingSound.TimeLength)
script.Parent.CurrentSound.Text = "Currently Playing:"
1 Like
This?
local PlayerGui = game:GetService(âPlayersâ).LocalPlayer:WaitForChild()
if PlayerGui:WaitForChild(âOofSoundsâ):WaitForChild(âAllOofSoundsLeftâ):WaitForChild(âOOFâ):WaitForChild(âOOFâ):WaitForChild(âPlayingâ) == true then
if game.StarterGui.OofSounds.AllOofSoundsLeft.Oof.Oof.Playing == true then
script.Parent.CurrentSound.Text = âCurrently Playing: Oofâ
wait(0.5)
script.Parent.CurrentSound.Text = âCurrently Playing:â
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OOF.OOF.Playing == true then
script.Parent.CurrentSound.Text = âCurrently Playing: OOFâ
wait(1.2)
script.Parent.CurrentSound.Text = âCurrently Playing:â
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofEchoed.OofEchoed.Playing == true then
script.Parent.CurrentSound.Text = âCurrently Playing: Oof (Echoed)â
wait(2.7)
script.Parent.CurrentSound.Text = âCurrently Playing:â
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.LoudOof.LoudOof.Playing == true then
script.Parent.CurrentSound.Text = âCurrently Playing: Loud Oofâ
wait(8.3)
script.Parent.CurrentSound.Text = âCurrently Playing:â
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofMusic.OofMusic.Playing == true then
script.Parent.CurrentSound.Text = âCurrently Playing: Oof Musicâ
wait(204)
script.Parent.CurrentSound.Text = âCurrently Playing:â
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofAstromania.OofAstromania.Playing == true then
script.Parent.CurrentSound.Text = âCurrently Playing: Oof Astromaniaâ
wait(67)
script.Parent.CurrentSound.Text = âCurrently Playing:â
elseif
game.StarterGui.OofSounds.AllOofSoundsLeft.OofLasagna.OofLasagna.Playing == true then
script.Parent.CurrentSound.Text = âCurrently Playing: Oof Lasagnaâ
wait(130)
script.Parent.CurrentSound.Text = âCurrently Playing:â
end
MarkiPr0
(Marki)
August 2, 2020, 6:14pm
17
No, youâre repeating the same error, you cannot do game.StarterGui.path.to.object in-game as everything has been moved from there, replace those if statements with the one I provided.
It⌠didnât work, now what do I do
Moonvane
(Moonvane)
August 2, 2020, 6:16pm
19
does the output window have any red text related to this script?
No, but also, if youâre trying to find out whatâs all in my starter gui explorer, hereâs the screenshot: