Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Counting script not doing anything. What's wrong?

Asked by 7 years ago
Edited 7 years ago

So I have these scripts : LocalScript in StarterPack (My guess would be the errors here somewhere, but yet again the value in the severstorage never changes)

song1 = game.Soundscape.puzzle
player = game.Players.LocalPlayer
player.PlayerGui:WaitForChild("ScreenGui")
gui = player.PlayerGui.ScreenGui.TextLabel
seconds = game.ServerStorage.seconds.Value

seconds = 30
if game.ServerStorage.roundover.Value == true then
gui.Text = "Next game starts in ".. seconds .." seconds!"
repeat 
gui.Text = "Next game starts in ".. seconds .." seconds!"
wait(1)
until
seconds == 0
end

Script in ServerScriptService

seconds = game.ServerStorage.seconds.Value
puzzle = game.Soundscape.puzzle
game.ServerStorage.roundover.Value = true

seconds = 30
if game.ServerStorage.roundover.Value == true then
    puzzle:Play()   
    repeat 
    seconds = seconds - 1
    wait(1)
until
    seconds == 0
    puzzle:Stop()
end

game.ServerStorage.roundover.Value = false

wait(5)

game.ServerStorage.roundover.Value = true

I want these scripts to (if you can't read it) make a gui count down, nothing happens, no error in the output, the text doesn't change. What's wrong?

1
Mind that it'll play play the sound and do the GUI stuff for only player 1, going from 30 to 0, then only player 2, going from 30 to 0, ... Maybe use a coroutine or spawn() einsteinK 145 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

I have a very simple script for you that works just fine! It even loops the song :) (or sound, your choice)

while true do
    wait(1)
    script.Parent.Sound:Play()
    wait(SOUNDLENGTH)
    wait(1)
end

If you do NOT want it to loop, do this:

roundStart = false

if roundStart == true then
    script.Parent.Sound:Play()
    wait(SOUNDLENGTH)
    roundStart = false
else
    wait()
end
0
I don't need it looped, I just wanna know what's wrong and get a fix for it theawesome624 100 — 7y
0
I updated it. You will, of course, have to find a method to toggle roundStart to true Jestined 0 — 7y
0
I want it to play the song while the counter counts down theawesome624 100 — 7y
0
Yes. Add a function that sets roundStart to true when the counter reaches 0 Jestined 0 — 7y
Ad

Answer this question