Hello Developers!
I have no idea if this is the right category or not so please, if this is not the right category then move it to the right one!
So the issue is that when I teleport or join my game, it makes my avatar go crazy!
Here is a video:
[robloxapp-20210402-2316122.wmv]
Thanks for reading and watching!
Sorry if you have to download the video!
May I see the script to teleport??
Thats very strange, did you use any free models from the toolbox while making it? Also I think you should search for scripts that have āCharacterā in it, this way you will at least know the script responsible.
local InGame = game.ReplicatedStorage.InGame
local FloorGlass = game.Workspace.GameSpawn.FloorGlass
local gameRoundTimer = 5
local roundLength = 5
local intermissionLength = 10
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameSpawn.GameAreaSpawn
InRound.Changed:Connect(function()
if InRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char:WaitForChild("HumanoidRootPart").CFrame = GameAreaSpawn.CFrame
end
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
end
end
end)
local function roundTimer()
while wait() do
for i = intermissionLength, 0, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
InRound.Value = true
end
for i = gameRoundTimer, 0, -1 do
wait(1)
Status.Value = "Dropping Players: ".. i .." seconds left!"
end
for i = roundLength, 0, -1 do
wait(1)
Status.Value = "Game: ".. i .." seconds left!"
InRound.Value = false
end
end
end
spawn(roundTimer)
Try using coroutines instead of spawn.
What are coroutines? And how do you get them?
I still donāt understand this.
I tried to use coroutine:
local InGame = game.ReplicatedStorage.InGame
local FloorGlass = game.Workspace.GameSpawn.FloorGlass
local gameRoundTimer = 5
local roundLength = 5
local intermissionLength = 10
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameSpawn.GameAreaSpawn
InRound.Changed:Connect(function()
if InRound.Value == true then
local teleportThread = coroutine.create(function()
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char:WaitForChild("HumanoidRootPart").CFrame = GameAreaSpawn.CFrame
end
else --error
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char:WaitForChild("HumanoidRootPart").CFrame = GameAreaSpawn.CFrame
end
end) --error
end
end) --error
local function roundTimer()
while wait() do
for i = intermissionLength, 0, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
InRound.Value = true
end
for i = gameRoundTimer, 0, -1 do
wait(1)
Status.Value = "Dropping Players: ".. i .." seconds left!"
end
for i = roundLength, 0, -1 do
wait(1)
Status.Value = "Game: ".. i .." seconds left!"
InRound.Value = false
end
end
end
spawn(roundTimer)
Try this out?
local InGame = game.ReplicatedStorage.InGame
local FloorGlass = game.Workspace.GameSpawn.FloorGlass
local gameRoundTimer = 5
local roundLength = 5
local intermissionLength = 10
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameSpawn.GameAreaSpawn
InRound.Changed:Connect(function()
if InRound.Value == true then
for _, player in pairs(game.Players:GetPlayers()) do
local char = player.Character
char:WaitForChild("HumanoidRootPart").CFrame = GameAreaSpawn.CFrame * CFrame.new(0,3.25,0)
end
else
for _, player in pairs(game.Players:GetPlayers()) do
local char = player.Character
char:WaitForChild("HumanoidRootPart").CFrame = LobbySpawn.CFrame * CFrame.new(0,3.25,0)
end
end
end)
local function roundTimer()
while wait() do
InRound.Value = false
for i = intermissionLength, 0, -1 do
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
InRound.Value = true
for i = gameRoundTimer, 0, -1 do
wait(1)
Status.Value = "Dropping Players: ".. i .." seconds left!"
end
for i = roundLength, 0, -1 do
wait(1)
Status.Value = "Game: ".. i .." seconds left!"
end
end
end
coroutine.wrap(roundTimer)()
You were changing the value inround every second in that first for loop, so it was spazzing you. Also you should add a y offset with the CFrame youāre setting to spawn the player in the air to prevent them getting stuck on the GameAreaSpawn