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!
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)
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.
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
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
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.