Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you make a player teleport to a game when they hit a brick even if they are non collide able?

Asked by 5 years ago
Edited 5 years ago

So recently I have been making a camping like game. Everything is go well expect for one thing, the user wont teleport when the vehicle moves into the brick that is meant to teleport them. And because the user is non collide able when sitting in a moving car.

Is there anyway of getting around this because I've tried killing the user when they hit the part, but that didn't work because the user is non collide able with anything whilst sitting.

The script I'm using for the car to move is this if you would like to know.

Car = script.Parent

while true do
 wait(55)
 for i = 1,100 do
  Car:TranslateBy(Vector3.new(2,0,0))
  wait()
 end
 for i = 1,100 do
  Car:TranslateBy(Vector3.new(-2,0,0)) 
  wait()
 end
end

And the code for the user teleporting when they should collide with the brick.

function onTouched(hit)
   local player = game.Players:GetPlayerFromCharacter(hit.Parent)
   if player then
       game:GetService("TeleportService"):Teleport(4450695917,player)  --replace the numbers with your place id
  end
end


script.Parent.Touched:connect(onTouched)
0
Are the 2 code blocks you sent under the same script? Twinbrotato 543 — 5y
0
No DiamondRules01 56 — 5y

Answer this question