Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to fix a teleport touchpad if a player is seated in a car?

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

2 answers

✓ Accepted answer

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)

8 comments

0

Added the teleportation script

0

It does not work can u show me if i add you to team creates?

0

Add me on discord: - ??Speedy ??-#2605

0

Give me your discord actually

0

?i?sc?o??d#7068

0

b r u hh

0

https://pastebin.com/jL6c7vVn i made a pasteabin with my name

0

Jesus christ, you made it so nobody can add you.. Add me https://pastebin.com/zXGMbEEX

See this for info

2 comments

0

the teleporter works if youre not in the car but not if u are idk why could u explain that to me

0

:( sorry

This discussion is preserved as it was. New answers, comments, and votes are closed.