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

How do I turn off the teleporter when winner is found?

Asked by 8 years ago

I tried to disable the teleporter script but it looks like its not working. I tried game.Workspace.TpScript.Disabled = true but it keeps sending player to the map. Heres the main script that makes it to be disabled :

--start
local Player1 = game.Players.PlayerAdded:wait()
--variables
Map1 = game.ServerStorage.Maps.Arena1
NotificationGui1 = game.Workspace.StatusBar.Gui1.TextBox
NotificationGui2 = game.Workspace.StatusBar.Gui2.TextBox

Winner = "None"
WinnerFound = false


game.Workspace.WinnerDetector.Touched:connect(function(Player)
    WinnerFound = true
    Winner = Player.Parent.Parent.Name
    Player.Parent.Humanoid.Health = 0
end)
while true do
NotificationGui1.Text = "Please Wait"
NotificationGui2.Text = "Please Wait"
print("Wait60")
wait(60)
NotificationGui1.Text = "Current Map :", Map1.MapName
NotificationGui2.Text = "Current Map :", Map1.MapName
print("LoadMap")
wait(5)
NotificationGui1.Text = "Loading..."
NotificationGui2.Text = "Loading..."
wait(2)
Map1:clone().Parent = game.Workspace
Player1.PlayerGui.WinnerGui.TextBox.Text = "Teleporting Players"
game.Workspace.TpScript.Disabled = false
wait(24)
NotificationGui1 = "Game In Progress"
NotificationGui2 = "Game In Progress"
Player1.PlayerGui.WinnerGui.TextBox.Text = "Game In Progress"
if WinnerFound then
wait(5)
WinnerFound = false
Player1.PlayerGui.WinnerGui.TextBox.Text = "Winner : ", Winner
game.Workspace.Map:destroy()
game.Workspace.TpScript.Disabled = true
Spawn1o = 0
Spawn2o = 0
Spawn3o = 0
Spawn4o = 0
Spawn5o = 0
Spawn6o = 0
NotificationGui1.Text = "Game Ended"
NotificationGui2.Text = "Game Ended"
wait(10)
Player1.PlayerGui.WinnerGui.TextBox.Text = "Winner : Not Found"

end
end

and the TpScript :

--Reciver Vars
Spawn1o = 0
Spawn2o = 0
Spawn3o = 0
Spawn4o = 0
Spawn5o = 0
Spawn6o = 0
enabled = true
Reciver = game.Workspace.Spawn.Spawn1
game.Workspace.TpSender.Touched:connect(function(part)
local hum = part.Parent:FindFirstChild("Humanoid")
    if hum~=nil then 
        if enabled == true then 
            enabled = false
            local t = part.Parent:FindFirstChild("Torso")
            local t2 = Reciver
            t.CFrame = CFrame.new(t2.Position.x, t2.Position.y+4, t2.Position.z)
            Spawn1o = Spawn1o +1
            wait(1)
            enabled = true
            if Spawn1o == 4 then
                Reciver = game.Workspace.Spawn.Spawn2
                if Spawn2o == 4 then
                Reciver = game.Workspace.Spawn.Spawn3
                    if Spawn3o == 4 then
                    Reciver = game.Workspace.Spawn.Spawn4
                        if Spawn4o == 4 then
                        Reciver = game.Workspace.Spawn.Spawn5
                            if Spawn5o == 4 then
                            Reciver = game.Workspace.Spawn.Spawn6
                            end
                        end
                    end
                end
            end
        end
    end
end)
0
just check if user is at specific location and then print running other condition, otherwise running main feature. scottmike0 40 — 8y
0
This is for minigame script so its hard enough to use specific location. krisxxxz 45 — 8y
0
Do you want to completely disable it ? (If so, set to true @ line 31 of the main script ) Vitou 65 — 8y
0
I want it to disable when winner is found. But I don't know how to make it work. If I change the line 31 to be true then it won't turn on when round starts. krisxxxz 45 — 8y

Answer this question