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:
spawn(function()
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 = UDim2.new(0,0,0,0)
game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Frame.Visible = true
game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Frame:TweenSize(UDim2.new(0.134, 0,0.076, 0), "Out", "Sine", .2)
game:GetService("ReplicatedStorage").Teleport:FireServer() -- Teleports the player on the Y-Axis a little bit higher
wait()
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
Humanoid:ChangeState(6)
BodyVelocity.Parent = Character.HumanoidRootPart
v3.Parent = Character.HumanoidRootPart
end
end
end
end
end)
There are’nt variables, but I hope, it’s still understandable.
I’d be very happy about any replies!