Help with teleporting all players inside a helicopter to lobby

I am making a game and all players have to escape on a helicopter but I have multiple issues with teleporting everybody inside the helicopter to the lobby the first issue is if the players are using the seats in the helicopter then if the teleportation happens it wont teleport the players but it does if the players are not in the sitting in the seats I made a function that makes the players jump before the teleportation but it does not work and I don’t know how to fix it and I also get an error in the output saying Humanoid is not a valid member of then it lists all the accessories on the players avatar and I don’t know why here is my code:

local debounce = false
local Status = game.ReplicatedStorage.Values.IsInLobby
local character = game.Players.LocalPlayer


function onTouched(hit)
		local character = hit.Parent:FindFirstChild("Humanoid")
		if character ~=nil then
		character.Jump = true
	end
end


script.Parent.Touched:Connect(function(hit)
	
	local part1 = game.Workspace.Helecopter.Teleporter
	local part2 = game.Workspace.Map.Lobby
	 
		wait(50)
		script.Parent.Touched:Connect(onTouched)
		print("TELEPORTING!") 
		
		
		wait(1.3)
	
	
	if hit and hit.Parent and hit.Parent.Humanoid then
		hit.Parent:SetPrimaryPartCFrame(part2.CFrame * CFrame.new(0, 5, -5))
end
		debounce = true
		Status.Value = true
		wait(20)
		debounce = false
end)

Thanks.

according to developer hub, the “seatweld” has to be destroyed before teleporting

seat:FindFirstChild(“SeatWeld”):Destroy()

3 Likes

hmm weird I made a script that makes the player jump then 0.5 seconds later the seat will get removed but it does not work until the player manually jumps off then it makes the player jump and destroys the seat here is the code:

local seat = script.Parent

function DESTROY(Hit)	
	local h = Hit.Parent:FindFirstChild("Humanoid")
	if h then
		wait(5)
		h.Jump = true
		wait(0.5)
		seat:Remove()
	end
end

seat.Touched:Connect(DESTROY)
local Part2 = workspace.Part2
local Seat = workspace.Seat
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if not Seat.Occupant then return end
	local Player = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent)
	if not Player then return end
	local Character = Player.Character
	if not Character then return end
	local Hrp = Character:FindFirstChild("HumanoidRootPart")
	local Humanoid = Character:FindFirstChild("Humanoid")
	if not Humanoid then return end
	if not Hrp then return end
	wait(3)
	if Seat.Occupant ~= Humanoid then return end
	Seat.Disabled = true
	wait(.25)
	Hrp.CFrame = Part2.CFrame + Vector3.new(0, 4.5, 0)
	wait(1)
	Seat.Disabled = false
end)
2 Likes

The teleporting works fine but it will also teleports the seat with the floor with the player how would I make the player jump maybe before the teleportation, Thanks. (The helicopter is being held together using join surfaces)

The seat is disabled which kicks the player from the seat, maybe you are still using an old script by accident

see here:
How to tp seated player without seat - Help and Feedback / Scripting Support - DevForum | Roblox

1 Like