I would like to know how to get the players torso. I understand that the player that is indexed in this script is the one here: game.Players.Player but I would like to know how to get the one indexed in game.Workspace.Player.
01 | local a = Instance.new( "Part" , game.Workspace) |
02 | a.Name = "Teleport" |
03 | a.Position = Vector 3. new(- 5.848 , 13 , - 95.462 ) |
04 | a.Anchored = true |
05 | local b = Instance.new( "ClickDetector" , a) |
06 | function playermover(hit) |
07 | local torso = hit.Torso |
08 | torso.Position = CFrame 3. new( 7 , 5 , - 55 ) |
09 | end |
10 | game.Workspace.Teleport.ClickDetector.MouseClick:connect(playermover) |
The Player in workspace is called your Player's Character
To access it, you index the Player like; Player.Character
, and it will get the Character in Workspace.
01 | local a = Instance.new( "Part" , workspace) |
02 | a.Name = "Teleport" |
03 | a.Position = Vector 3. new(- 5.848 , 13 , - 95.462 ) |
04 | a.Anchored = true |
05 |
06 | local b = Instance.new( "ClickDetector" , a) |
07 |
08 | function playermover(hit) --'hit' would be the Player |
09 | local torso = hit.Character.Torso --Player.Character.Torso is Torso. |
10 | torso.CFrame = CFrame.new( 7 , 5 , - 55 ) --CFrame them so they won't die. |
11 | end |
12 |
13 | workspace.Teleport.ClickDetector.MouseClick:connect(playermover) |