Intermission script not working!

so it works, but it teleports me and it doesent teleport me back!
script:

local status = game.ReplicatedStorage.Values:WaitForChild("Status")
local inround = game.ReplicatedStorage.Values:WaitForChild("inround")
local spawnlocation = game.Workspace:FindFirstChild("SpawnLocation")
local tp1 = game.Workspace:FindFirstChild("TP1")
local tp2 = game.Workspace:FindFirstChild("TP2")

while true do
	for i = 6, 0, -1 do
		inround.Value = false
		status.Value = "intermission: "..i
		task.wait(1)
	end
	status.Value = "Choosing map"
	wait(2)
	
if inround then
		for i,v in pairs(game.Players:GetPlayers()) do
			v.Character.HumanoidRootPart.Position = tp1.Position or tp2.Position
		end
	end
	
	if  not  inround   then
		for i,v in pairs(game.Players:GetPlayers()) do
			v.Character.HumanoidRootPart.Position = spawnlocation.Position
		end
		end

	
	for i = 5, 0, -1 do
		inround.Value = true
		status.Value = "in game: "..i
		task.wait(1)
	end
	
end

gui local script:

local status = game.ReplicatedStorage.Values:WaitForChild("Status")

status:GetPropertyChangedSignal("Value"):Connect(function()
	script.Parent.Text = status.Value
end)

not working:

if  not  inround   then
		for i,v in pairs(game.Players:GetPlayers()) do
			v.Character.HumanoidRootPart.Position = spawnlocation.Position
		end
		end

this isnt working like it wont teleport me back!

and inround is a boolvalue!
Status is a stringvalue!

You should probably put this in scripting support.

But anyways, is inround meant to be a value, or simply an object value that you check if exists?

inround is a boolvalue it checks if a player is in round or not!
btw sorry for the mistake i misclicked somthing else!

inround is never set to false, so it will never teleport you back.

but i did in the first loop inround.Value = false

btw sorry i am missclicking sometimes a button!

Oh I know what you did wrong.
These

Have to be

inround.Value

So it would be

if inround.Value then

and

if not inround.Value then

If the problem you’re stating is the fact that it’s not teleporting you, you need to use

local Character = v.Character or v.CharacterAdded:Wait()

And you need to move the character by doing

Character:PivotTo(spawnlocation.CFrame)

The problem is that you cannot move a character by changing its position, and you are not waiting for the character to full load before teleporting them (Or checking if the character exists)

Sources:
PivotTo
CFrame

1 Like

but if inround then is working… cuz it teleports me but it wont teleport me back!

If you use:

if inround then
    -- inround is an objectValue and it will return true if it's not destroyed

And you never destroy inround so it’ll never change.
Using inround.Value will fix it.

You wrote it wrong in the if statements it has to be
inround.Value and not inround.

1 Like

If this solved your topic could you put it as solution so that the topic gets shelved and people understand what the issue is when they stumble upon this topic. :smile:

it still dint worked i did it like this:

local status = game.ReplicatedStorage.Values:WaitForChild("Status")
local inround = game.ReplicatedStorage.Values:WaitForChild("inround")
local spawnlocation = game.Workspace:FindFirstChild("SpawnLocation")
local tp1 = game.Workspace:FindFirstChild("TP1")
local tp2 = game.Workspace:FindFirstChild("TP2")

while true do
	for i = 6, 0, -1 do
		inround.Value = false
		status.Value = "intermission: "..i
		task.wait(1)
	end
	status.Value = "Choosing map"
	wait(2)
	
if inround.Value then
		for i,v in pairs(game.Players:GetPlayers()) do
			local Character = v.Character or v.CharacterAdded:Wait()
			Character:PivotTo(tp1.CFrame or tp2.CFrame)
		end
	end
	
	if  not  inround.Value   then
		for i,v in pairs(game.Players:GetPlayers()) do
			local Character = v.Character or v.CharacterAdded:Wait()
			Character:PivotTo(spawnlocation.CFrame)
		end
		end

	
	for i = 5, 0, -1 do
		inround.Value = true
		status.Value = "in game: "..i
		task.wait(1)
	end
	
end

try

local status = game.ReplicatedStorage.Values:WaitForChild("Status")
local inround = game.ReplicatedStorage.Values:WaitForChild("inround")
local spawnlocation = game.Workspace:FindFirstChild("SpawnLocation")
local tp1 = game.Workspace:FindFirstChild("TP1")
local tp2 = game.Workspace:FindFirstChild("TP2")

while true do
	for i = 6, 0, -1 do
		inround.Value = false
		status.Value = "intermission: "..i
		task.wait(1)
	end
	status.Value = "Choosing map"
	wait(2)
	
if inround.Value == true then
		for i,v in pairs(game.Players:GetPlayers()) do
			local Character = v.Character or v.CharacterAdded:Wait()
			Character:PivotTo(tp1.CFrame or tp2.CFrame)
		end
	end
	
	if  inround.Value == false  then
		for i,v in pairs(game.Players:GetPlayers()) do
			local Character = v.Character or v.CharacterAdded:Wait()
			Character:PivotTo(spawnlocation.CFrame)
		end
		end

	
	for i = 5, 0, -1 do
		inround.Value = true
		status.Value = "in game: "..i
		task.wait(1)
	end
	
end

It’s worth a try.

1 Like

also wont work ;( it teleports me but it wont tp me back!!

soemone help me solve this problem pls!

but it did teleport me here but it doesent tp me back!

i figured it out

while true do
	for i = 6, 0, -1 do
		inround.Value = false
		status.Value = "intermission: "..i
		task.wait(1)
	end
	status.Value = "Choosing map"
	wait(2)
	
    if inround.Value == true then
		for i,v in pairs(game.Players:GetPlayers()) do
			local Character = v.Character or v.CharacterAdded:Wait()
			Character:PivotTo(tp1.CFrame or tp2.CFrame)
		end
	end
	
	if  inround.Value == false  then
		for i,v in pairs(game.Players:GetPlayers()) do
			local Character = v.Character or v.CharacterAdded:Wait()
			Character:PivotTo(spawnlocation.CFrame)
		end
		end

	
	for i = 5, 0, -1 do
		inround.Value = true
		status.Value = "in game: "..i
		task.wait(1)
	end
	
end

Every time it loops through it’s false. By the time it’s true, the if loop that checks for it being true has already passed. When it starts over, it’s false again, making it never able to be true whilist the if loops being right after it.

1 Like

it still teleported me there but dint tp me back… bro what the hell!

I dont understand your code why do you teleport the Player and teleport them instantly back again?