Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am trying to teleport the player but it only kills them, what do I do?

Asked by 1 year ago

Here is the code I am trying to do:



local RoundLength = 15 local internmissionLength = 25 local Inround = game.ReplicatedStorage.InRound local Status = game.ReplicatedStorage.Status local Lobby = game.Workspace.Lobby local PlayerSpawn = game.Workspace.PlayerSpawn Inround.Changed:Connect(function() if Inround.Value == true then for _, player in pairs(game.Players:GetChildren()) do local char = player.Character char.HumanoidRootPart.CFrame = PlayerSpawn.CFrame end else for _, player in pairs(game.Players:GetChildren()) do local char = player.Character char.HumanoidRootPart.CFrame = Lobby.SpawnLocation.CFrame end end end) local function InRound() while wait() do for i = internmissionLength, 1, -1 do Inround.Value = false wait(1) Status.Value = "Intermission: "..i.." Seconds left!" end for i = RoundLength, 1, -1 do Inround.Value = false wait(1) Status.Value = "Chapter Selection "..i.." Seconds remaining to choose!" end Inround.Value = true Status.Value = "Chapter 1 has been selected" wait(2) Status.Value = "Bot is the gamemode!" wait(2) local GUI = game.StarterGui GUI.ScreenGui.PlayTableUI.Enabled = false end end spawn(InRound) local CC = workspace.CurrentCamera local CCam1 = workspace.CutsceneThings.CutsceneCam1 local tween = game:GetService("TweenService") if Inround.Value == true then CC.CameraType = Enum.CameraType.Scriptable local function TCP(Point, Speed) tween:Create(CC, TweenInfo.new(Speed, Enum.EasingStyle.Linear), {CFrame = Point.CFrame}):Play() end TCP(CCam1, 1) end

It won't work and keeps killing the player when trying to teleport. I also have a custom character with a HumanoidRootPart in it.

1 answer

Log in to vote
0
Answered by 1 year ago

It might be with the custom character part as that might cause the system to glitch out and kill the player in a teleport using cframe. you might want to check the humanoid root properties to check how much health it has, as below 10 can cause you to die in a teleport.

0
@akbanana7, the humanoid does have a health of 100. ink12345dp 0 — 1y
Ad

Answer this question