There was no teleportation ever provided, But i’m sure you can figure it out
I’ve came up with a solution but the teleport still doesn’t work:
local function SetStatusMessage(message)
status.Value = message
end
local function TeleportToSpawnPoint(spawnPoint)
local character = game.Players.LocalPlayer.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.CFrame = CFrame.new(spawnPoint.Position)
end
end
end
inRound.Changed:Connect(function()
if inRound.Value == true then
SetStatusMessage("In Round")
TeleportToSpawnPoint(game.Workspace.DropGame.RoundSpawn)
else
SetStatusMessage("In Lobby")
TeleportToSpawnPoint(game.Workspace.Lobby.LobbySpawn)
end
end)
i don know what i did wrong can you please give me some tipps or sum? imma also try to debug first so i can see if there are errors! (there is an error)
This needs to be
humanoidRootPart.CFrame = spawnPoint.CFrame (assuming the spawnpoint is a part and not a model)
how am i ment to teleport to the other part now im completly confused!
Just use the same function?
It works fine
I dont want to ask for an example since i have to learn this stuff but now i have to ask you if you could give an example!
There is no example to be given. I gave you the code which is needed to make it work.
Once again, google couldve easily fixed it.
Look back at my reply i gave before. The answer is there
thats why i dont understand really so how should i place it ? should i double it for lobby and playing??
You modify the function code to what i said. I’m not providing you the code since its only one line. Read what i said carefully, Its seriously one line
I understand that its only 1 line but my question was how it would work because if i put in
game.Workspace.Lobby.LobbySpawn
it does only tp me to that 1 point when i understand the code right
No. If you modified your function code to what i said, it should work all fine.
You can call the function easily by doing this:
TeleportToSpawnPoint(pathToObjectHere)
sorry misunderstoot your point at the code lemme try it rq. btw should i add Cframe at the end or just the spawnpoint like the long code?
@BoredHelperDEV is this right like this?:
local function TeleportToSpawnPoint(spawnPoint)
local character = game.Players.LocalPlayer.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.CFrame = spawnPoint.CFrame(game.Workspace.Lobby.LobbySpawn)
end
end
end
inRound.Changed:Connect(function()
if inRound.Value == true then
SetStatusMessage("In Round")
TeleportToSpawnPoint(game.Workspace.DropGame.RoundSpawn)
else
SetStatusMessage("In Lobby")
TeleportToSpawnPoint(game.Workspace.Lobby.LobbySpawn)
end
end)
if not tell me what i did wrong
Not really, This is the correct function.
local function TeleportToSpawnPoint(spawnPoint)
local character = game.Players.LocalPlayer.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.CFrame = spawnPoint.CFrame
end
end
end
this still doesnt work when i replace it! and i also know why
Can you show me your whole code
here is the whole code i use:
local intermission = 30
local roundLength = 170
local inRound = game.ReplicatedStorage.InRound
local status = game.ReplicatedStorage.Status
local function SetStatusMessage(message)
status.Value = message
end
local function TeleportToSpawnPoint(spawnPoint)
local character = game.Players.LocalPlayer.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.CFrame = spawnPoint.CFrame
end
end
end
inRound.Changed:Connect(function()
if inRound.Value == true then
SetStatusMessage("In Round")
TeleportToSpawnPoint(game.Workspace.DropGame.RoundSpawn.CFrame)
else
SetStatusMessage("In Lobby")
TeleportToSpawnPoint(game.Workspace.Lobby.LobbySpawn.CFrame)
end
end)
local function round()
while true do
local requiredPlayers = 1
repeat
wait(1)
SetStatusMessage("Waiting for players...")
until #game.Players:GetPlayers() >= requiredPlayers
inRound.Value = false
for i = intermission, 0, -1 do
SetStatusMessage("Game will start in "..i.." seconds")
wait(1)
end
inRound.Value = true
local roundEnded = false
local winningPlayer = nil
for i = roundLength, 0, -1 do
SetStatusMessage("Game will end in "..i.." seconds")
local playing = {}
for _, plr in pairs(game.Players:GetPlayers()) do
if not plr.Team then
table.insert(playing, plr)
end
end
if #playing == 0 then
SetStatusMessage("Everyone Has Died")
roundEnded = true
break
end
if #playing == 1 then
local winner = playing[1]
SetStatusMessage(winner.Name.." Has Won The Game!")
winningPlayer = winner
roundEnded = true
break
end
wait(1)
end
if not roundEnded then
SetStatusMessage("The round has ended")
end
if winningPlayer then
-- Player has won the game, Add more code here if you want to.
local randomCoins = math.random(20, 100)
winningPlayer.leaderstats.Wins.Value += 1
if winningPlayer.MembershipType == Enum.MembershipType.Premium then
randomCoins = randomCoins * 2
end
winningPlayer.leaderstats.Coins.Value += randomCoins
end
wait(3)
end
end
spawn(round)
You’re not using the function correctly. Open the output and you see that there will be an error. Once again, that error can easily be googled. Look at the function and understand what it does.
You’re adding the CFrame twice, You only need to include the path when using the function.
it gave me a error in line 16 and nowhere else
Once again, try not creating that many replies. If you have information, put it in your reply, Now i have to ask you what the error was and that costs 2 replies, Mines and yours. You can also google the error and figure it out yourself, You learn a lot that way