This is kinda killing players when they touch the part.
1 | part = script.Parent |
2 |
3 | function Touched (char) |
4 | char.Position = Vector 3. new( 10 , 10 , 10 ) |
5 |
6 | end |
7 |
8 | script.Parent.Touched:connect(Touched) |
Try Using the moveto function:
01 | part = script.Parent |
02 | cords = 10 , 10 , 10 -- put cords here |
03 | local Human = char.Parent:FindFirstChild( "Humanoid" ) |
04 |
05 | local Player = char.Parent |
06 | function Touched (char) |
07 |
08 | Player:MoveTo(Vector 3. new(cords)) |
09 |
10 | end |
11 |
12 | script.Parent.Touched:connect(Touched) |
Hope i help!
Please accept this answer:
It may have to do with humanoid that you got.
What part of the character are you moving? I would use CFrame on the Torso. That will tp the player to anywhere you want without killing them in the process.
Use :MoveTo()
1 | part = script.Parent |
2 |
3 | function Touched (char) |
4 | char:MoveTo( 10 , 10 , 10 ) |
5 |
6 | end |
7 |
8 | script.Parent.Touched:connect(Touched) |
Unfortunately the method you used to move the character unfortunately moved the character's limbs using the Position property, breaking all joints and killing the player's character.
01 | local coords = CFrame.new( 0 , 10 , 0 ) |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | if hit then |
05 | if hit.Parent then |
06 | if hit.Parent:FindFirstChild( 'Humanoid' ) then |
07 | if hit.Parent.Humanoid.Torso then |
08 | hit.Parent.Humanoid.Torso.CFrame = coords |
09 | end |
10 | end |
11 | end |
12 | end |
13 | end ) |
The above code is meant to teleport a player to the specified coordinates without unexpectedly teleporting them on top of a building if you wanted to teleport them inside. That's the problem with MoveTo()
and Position
.
I hope you find my answer helpful, I live to help (not really).