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

My script teleports the players a lot. Did I do something wrong?

Asked by 6 years ago

To make it short, it often stutters. What I mean by that is that in the middle of the script there's a part where you teleport players. But it always teleports them twice.

Here's my script.

local textLabel = script.Parent

while wait(3) do
if game.Players.NumPlayers > 1 then
    wait(4)

    game.Workspace.Intermission.Playing = true
    for i = 15, 1, -1 do
        textLabel.Text = "Intermission:  "..i
        wait(1)
    end
    textLabel.Text = "Intermission:  0"
    wait(1)
    textLabel.Text = "I see you're looking at this text ;)"
    wait()
    textLabel.Text = " "
    wait(1)
    textLabel.Text = "pls w8 we make map ;,,("
    wait(2)
    local mapOne = game:GetService("ReplicatedStorage")
    mapcloned = mapOne.Map:Clone()
    mapcloned.Parent = game.Workspace
    local BarrierOne = game:GetService("ReplicatedStorage")
    barrierClone = BarrierOne.Barrier:Clone()
    barrierClone.Parent = game.Workspace

    textLabel.Text = "Making map,please wait..."

    wait(2)
    target = CFrame.new(2, 318.5, -3.5) 
            for i, player in pairs(game.Players:GetChildren()) do
                if player.Character:FindFirstChild("HumanoidRootPart") then
                wait()
            player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
            wait()
        end
    end

    for i = 10, 1, -1 do
        textLabel.Text = "get ready b because it starts in: "..i
        wait(1)
    end
    workspace.Barrier:Destroy()

    for i,v in pairs(game.Players:GetPlayers()) do

        if v then

            wait()
            table.insert(_G.playersLeft, v.Name)
        end

    end
    wait(1)
    textLabel.Text = "Good luck!"

    wait()
    textLabel.Text = ""
wait(1)
for i = 60,2,-1 do

    textLabel.Text = i.." seconds left."
    wait(1)
    if i == 3 then
        textLabel.Text = "2 seconds left."
        wait(1)
        textLabel.Text = "1 second left!"
    end
end


textLabel.Text = "Clearing map..."

wait(2)

workspace.Map:Destroy()

wait(3)

textLabel.Text = "All good to go now! Let's get back to the intermission!"

else
wait(5)

    textLabel.Text = "You need 1 more player"
end
end

0
Is this script in a Text Label inside a GUI? If this is a script that handles intermission and teleportation, then it has to be a server script in the ServerScriptService UgOsMiLy 1074 — 6y
0
Yeah, the script is in a text label in a gui. How would I get everything to work out? Do I need to put the script in ServerScriptService instead? GIassWindows 141 — 6y

Answer this question