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

My script tends to skip the intermission?[This script is driving me nuts]

Asked by 4 years ago
Edited 4 years ago

I created this script for my mini-game place. It tends to skip the intermission?

I think this is very easy to solve

hmmmm....

local Intermission = game.Workspace.Intermission -- READ: (This is an IntValue)
game.Players.LocalPlayer.CharacterAdded:Connect(function(Character) 
while true do
    wait(1)
    Intermission.Value = Intermission.Value - 1
    script.Parent.Text = Intermission.Value
    if Intermission.Value == 0 then
        local String = "Teleporting Players..."

        for i = 1, #String do
            script.Parent.Parent.Index.Text = string.sub(String, 1, i)
        end

        wait(3)
        break
    end
end
end)
0
Most likely because you're having multiple clients modify a global value, making it subtract faster. Ziffixture 6913 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

In this situation, i think you need to use repeat here:

local Intermission = game.Workspace.Intermission -- READ: (This is an IntValue)
game.Players.LocalPlayer.CharacterAdded:Connect(function(Character) 
while true do
    wait(1)
repeat
    Intermission.Value = Intermission.Value - 1
    script.Parent.Text = Intermission.Value
 wait(1)
until script.Parent.Value <= 0 
    -- we no longer need a if statement
        local String = "Teleporting Players..."

        for i = 1, #String do
            script.Parent.Parent.Index.Text = string.sub(String, 1, i)
        end

        wait(3)
        break
end
end)

I hope it worked :D

0
I appreciate the answer man, But roblox studio took a big fat L, ashamed that it did not work. Thanks for your time and perception :D maxpax2009 340 — 4y
1
Here's an up-vote since you responded nicely. maxpax2009 340 — 4y
0
Sorry, i saw a bit of mistake and fixed it :D, maybe you could check it again? Nguyenlegiahung 1091 — 4y
Ad

Answer this question