#Getting Players and teleporting all of them at a position when part is touched

86 messages · Page 1 of 1 (latest)

tepid chasm
#

get all the characters first like this:

for _,player in ipairs(game.Players:GetPlayers()) do
    local plr = player.Character
end```

it might not work cuz i written without testing
#

try it

#

and we will see if that works

#

rasist

#

racist

#

you called me a monkey

#

nvm

lone hare
#

i don't really have any knowledge of humanoidrootparts

tepid chasm
shrewd aspen
#

thats easy

tepid chasm
#

that is what u need to do

shrewd aspen
#

ill just give u a script

tepid chasm
shrewd aspen
#

function onTouched(part)
if part.Parent == nil then return end
local h = part.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
h.Parent:MoveTo(game.Workspace.E.Position)
end
end

tepid chasm
#

NOOO

shrewd aspen
#

Replace E with the part

#

you want to teleport to

tepid chasm
#

how will he learn

#

delete that

shrewd aspen
shrewd aspen
#

it works though

tepid chasm
#

you should use CFrame

shrewd aspen
#

wdym

#

works perfectly fine

#

every single time

tepid chasm
#

use Cframe and vecters

shrewd aspen
#

its the same thing

#

its made to teleport

tepid chasm
#

i will send the best code

shrewd aspen
#

to a specific location

#

no it teleports them there

#

at the exact position

lone hare
#

do i need the cframe or the humanoidrootpart position

shrewd aspen
#

you dont need anything

#

just use the script i provided

#

and follow the instructions

#

it should work perfectly

#

it works

#

why do u want him

#

to create it himself

#

he can learn off the code

tepid chasm
#
script.Parent.Touched:Connect:function(hit)
if hit.Parent:FindFirstChild("Humaniod") then
  for _,player in ipairs(game.Players:GetPlayers()) do
      local plr = player.Character
      plr.Humanoid.Health = 0
  end
end)``` @lone hare
shrewd aspen
#

in the script

lone hare
#

i was doing it like this

tepid chasm
#

use this lua script.Parent.Touched:Connect:function(hit) if hit.Parent:FindFirstChild("Humaniod") then for _,player in ipairs(game.Players:GetPlayers()) do local plr = player.Character plr.Humanoid.Health = 0 end end) @lone hare

shrewd aspen
#

my script works like a charm

tepid chasm
# lone hare i was doing it like this

just use this lua script.Parent.Touched:Connect:function(hit) if hit.Parent:FindFirstChild("Humaniod") then for _,player in ipairs(game.Players:GetPlayers()) do local plr = player.Character plr.Humanoid.Health = 0 end end) @lone hare

#

and set a spawn there

#

so yeah

lone hare
#

ok

tepid chasm
#

i said there

#

set a spawn at the brick

#

it works

#
script.Parent.Touched:Connect:function(hit)
if hit.Parent:FindFirstChild("Humaniod") then
  for _,player in ipairs(game.Players:GetPlayers()) do
      local plr = player.Character
      plr.HumanoidRootPart.Position = Vector3.new(script.Parent.Position)
  end
end)``` @lone hare  updated
lone hare
tepid chasm
#

the scripts parent is the part

#

if that doesn;t work remove the position

lone hare
#

can't i do like Vector3.new(205.7, 13.5, 4.6)?

#

ah yes it worked

tepid chasm
#

yay

tepid chasm
tepid chasm
lone hare
#

i used mine

tepid chasm
#

i helped a bit

lone hare
#

ye

tepid chasm
#

right?

#

yay

#

thanks

lone hare
#

cuz i didn't knew how to code the plr.HumanoidRootPart.Position = Vectro3.new(etc..)

#

xD

tepid chasm
#

xD

lone hare
#

i really need to get better at scripting

tepid chasm
#

are u good at modelling

lone hare
#

this is like the 4th time im using the posts for these things

lone hare
#

idk

lone hare
tepid chasm
#

we got it working