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

How to fix a teleporting bug/problem in my script (it only teleport sometimes)?

Asked by 6 years ago
while true do
    local mini = 2
    if game.Players.NumPlayers < mini then  -- If it is 1 player then
        game.Workspace.Settings.Message.Value = mini - game.Players.NumPlayers.. " more player need to join." -- Say that we need 1 more player
        wait(5)
    else
        for i = 15,1,-1 do
            game.Workspace.Settings.Message.Value = "A new round will start in "..i.." seconds" 
            wait(1)
        end
        for i,v in pairs(game.Players:GetChildren()) do
            -- Clone Map
            v.PlayerGui.MainGui.RunnerLoader.Visible = true
            v.Character.Torso.CFrame = CFrame.new(184, 3, -90) -- This aint working
            v.TeamColor = game.Teams.Runner.TeamColor
            v.PlayerGui.MainGui.Values.Died.Value = false
            local Players = game:GetService'Players'
            local Playing = Players:GetPlayers()    
            local Murder = Playing[math.random(#Playing)]
            Murder.TeamColor = game.Teams.Catcher.TeamColor
            Murder.Character.Torso.CFrame = CFrame.new(274, 3, -255)
            wait(2)
            game.Workspace.Settings.Message.Value = Murder.Name.." is the catcher, run NOW!"    
            v.PlayerGui.MainGui.RunnerLoader.Visible = false
            Murder.PlayerGui.MainGui.MurderLoader.Visible = true
            Murder.Character.Torso.NameTag.TextLabel.TextColor3 = Color3.fromRGB(255,0,0)
            for i = 5,1,-1 do
                game.Workspace.Settings.Message.Value = "The catcher is coming in "..i.." seconds!"
                wait(1)
            end
            Murder.PlayerGui.MainGui.MurderLoader.Visible = false
            for i = 50,1,-1 do
                game.Workspace.Settings.Message.Value = "The current game has "..i.." second remaining"
                wait(1)
            end
            local text
            local PlayersSurvived = {}
            if v.PlayerGui.MainGui.Values.Died.Value == false then
                table.insert(PlayersSurvived, v.Name)
            end
            v.PlayerGui.MainGui.Values.Died.Value = true
            v.Character.Torso.CFrame = CFrame.new(4, 104, -5) -- This aint wotking
            v.TeamColor = game.Teams.Spectator.TeamColor
            Murder.Character.Torso.NameTag.TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
            text = table.concat(PlayersSurvived, ", ") .. " did survive!"
            game.Workspace.Settings.Message.Value = text
            wait(5)
        end
    end
end

On line 14 and 42 it are supposed to teleport, sometimes it does sometimes it dosent. How do I fix this?

0
Not sure if this is the issue but NumPlayers is deprecated. Optimalpokemon123 37 — 6y
0
vector3? ILikeTofuuJoe 1 — 6y
0
The 56655th question... ILikeTofuuJoe 1 — 6y
0
I still need help GroovyFhish 8 — 6y

Answer this question