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

Script overlapping and restarting for every person entering the server?

Asked by 5 years ago
Edited 5 years ago

I have a couple of local scripts on a game that im developing that's supposed to count down until the game starts and then pick a random player to be the button presser person and then the buttons that are pressed will move a platform up or down or remove a block or something,

but it restarted and overlapped itself for every new person that joined the server and started a new glitchy countdown over the original one, so I added a debounce and now it doesn't overlap.

However, the game now selects a random person for each person in the server because the script is running individually for each person and when the platform rises or falls it only appears for the person pressing the button and the other people on the platform see no changes. How would i go about fixing this? Here are the scripts by the way. this one's kind of long

local debounce = false

if debounce == false then
    debounce = true
local countTime = game.Workspace.Values.tillGameCountdown.Value

while countTime >= 0 do
    script.Parent.Text = countTime
    countTime = countTime - 1
    wait(0.9)
end

script.Parent.Text = "Round Starting..."
for _, player in pairs(game.Players:GetPlayers()) do
    if player.Character then
        player.Character:MoveTo(Vector3.new(-10, 17.5, -2))
        script.Parent.CutsceneScript.Disabled = false
    end
end
game.Workspace.Music.gameStartMusic.TimePosition = 16.7
game.Workspace.Music.gameStartMusic:Play()
game.Workspace.Values.InLobby.Value = false
game.Workspace.Music.lobbyWaiting:Stop()
game.Workspace.Values.gameOn.Value = true
script.Parent.Parent.Parent.Visible = false
wait(4.9)
game.Workspace.Music.gameStartMusic:Stop()
game.Workspace.Music.gameStartMusic.TimePosition = 16.7
game.Workspace.Music.gameMusic:Play()
script.Parent.Parent.Parent.Visible = true
script.Parent.Parent.Parent.Parent.Parent.RoundControl.Disabled = false

script.Disabled = true
end
0
Ew don't use MoveTo... use SetPrimaryPartCFrame. Also, you won't be able to do all that locally User#19524 175 — 5y

Answer this question