Game Development Bug

hello there, I have ran into a issue in my game if you could help me out that would be great.

after teleporting into the round it teleports me into the void instead.

here is my code:
local roundLength = 30
local intermissionLength = 10
local InRound = game.ReplicatedStorage.InRoumd
local Status = game.ReplicatedStorage.Status

local LobbySpawn = game.Workspace.Lobby.LobbySpawn
local GameSpawn = game.Workspace.GameSpawn

InRound.Changed:Connect(function()
if InRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = GameSpawn.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, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = “Intermission: “… i …” seconds remaining”

	end
	for i = roundLength, 1, -1 do
		InRound.Value = true
		wait(1)
		Status.Value = "Game: ".. i .." seconds remaining"
	end
end

end

spawn(roundTimer)

here is some other code that might play a part in the issue(currently disabled):

while true do
wait(100000000000)
local num = math.random(1, #game.Players:GetChildren())

game.Players:GetChildren()[num].Character.HumanoidRootPart.CFrame = CFrame.new(339, 274, -74)

end

I dont have a very good knowledge on lua as im still learning, if you can find a fix that would be great, thank you and have a nice day :+1:

1 Like

the code area is kinda weird oh well

1 Like

Hi there!
Can you please show game.Workspace.Lobby.LobbySpawn and game.Workspace.GameSpawn in the explorer?
I also noticed you made a typo in this line

local InRound = game.ReplicatedStorage.InRoumd
2 Likes

here is the lobbyspawn:


lobbyspawn is a checkpoint/spawn point

here is the gamespawn:


gamespawn is a part

also thanks for noticing the typo :+1:

Instead of changing the player’s CFrame here, change the position.
For instance;

char.HumanoidRootPart.Position = LobbySpawn.Position
1 Like

it works!
thanks alot for helping me!!! :+1: :+1:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.