Character is falling down after respawn

I want, that the player spawns in the air and that the player does’nt fall down.

So I added a script into “StarterCharacterScripts” and after you join the game and after you died, I scripted, that you spawn at the checkpoint, where you were last. The checkpoint is in the air, and I scripted in the FlyScript, that the player flies, when the script is activated, which is the case, after the player respawns. But sometimes the player stay in the air and sometimes the player is falling down.

I already tried to put there lines of code before the main script:

repeat wait(1) until script.Parent:FindFirstChild("HumanoidRootPart")
repeat wait(1) until script.Parent.Parent == workspace

But it still doesnt work.
Here is the script that makes the player fly after respawning:

	if game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Stage").Value ~= 0 then
		if timeWait == false then
			if db == false then
				if Flying == false then
					Flying = true
					game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Frame2.Visible = false
					game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Frame2.Size =,0,0,0)
					game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Frame.Visible = true
					game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Frame:TweenSize(, 0,0.076, 0), "Out", "Sine", .2)
					game:GetService("ReplicatedStorage").Teleport:FireServer() -- Teleports the player on the Y-Axis a little bit higher
					v10:Play(0.1, 1, 1)
					Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
					Humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
					Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
					Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
					Character:WaitForChild("HumanoidRootPart").Running.Volume = 0
					BodyVelocity.Parent = Character.HumanoidRootPart
					v3.Parent = Character.HumanoidRootPart

There are’nt variables, but I hope, it’s still understandable.
I’d be very happy about any replies!

Are you waiting for the Player as well? If they aren’t loaded in then this code isn’t going to run for them.

1 Like

Is’nt the player loaded automatically after the character is added?