So i was making a game like camping but i run across a error i tried to make a part that would teleport u but because youre seated it wont teleport you i tried to kill the player before the teleportation but that wont work can anyonehelp me?
-- teleport script
function onTouched(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then game:GetService("TeleportService"):Teleport(866960826,player) end end script.Parent.Touched:connect(onTouched)
-- car script
Car = script.Parent while true do wait(5) for i = 1,100 do Car:TranslateBy(Vector3.new(0,0,-1)) wait() end for i = 1,100 do Car:TranslateBy(Vector3.new(0,0,1)) wait() end end
Copypasta from my previous post
-- Regular Script inside of the seat players = game:GetService("Players") seat = script.Parent active = false plr = nil seat.ChildAdded:Connect(function(child) -- event for the seat if not active then -- ensuring this check is false if they are standing if child.Name == "SeatWeld" then -- finding the weld active = true plr = players:GetPlayerFromCharacter(child.Part1.Parent) if plr ~= nil then -- ensuring its a player plr.Character.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) wait(4.8) game:GetService("TeleportService"):Teleport(866960826, plr) end end end end) seat.ChildRemoved:Connect(function(child) if child.Name == "SeatWeld" then if active == true then active = false wait() -- stop your result end end end)
Here's to force the player to jump before teleporting
function onTouched(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then player.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) game:GetService("TeleportService"):Teleport(866960826, player) end end script.Parent.Touched:Connect(onTouched)
See this for info