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

Script is killing players?

This is kinda killing players when they touch the part.

part = script.Parent

function Touched (char)
	char.Position = Vector3.new(10,10,10)
	
end

script.Parent.Touched:connect(Touched)

5 answers

✓ Accepted answer

Try Using the moveto function:

part = script.Parent
cords = 10, 10, 10 -- put cords here
local Human = char.Parent:FindFirstChild("Humanoid")

	local Player = char.Parent
function Touched (char)

    Player:MoveTo(Vector3.new(cords))

end

script.Parent.Touched:connect(Touched)

Hope i help!

8 comments

0

Does not work

0

I fixed it though. Thanks :)

0

There i fixed forgot to include a line.

0

No problem glad i could help :D

0

I fixed YOUR script. You did it wrong, you needed the variables in the function

0

oh, ok i made a mistake, but again, glad i could help :D

0

stuffs phone cord in variable What? It said cords! D:<

0

0.o That might work...

Please accept this answer:

It may have to do with humanoid that you got.

3 comments

0

I'll just give you an upvote.

0

Well, Anything is fine. Thanks a lot :). May you please answer my questions because you are awesome.

0

Omg so old!

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.

1 comment

0

Make the script for me please.

Use :MoveTo()

part = script.Parent

function Touched (char)
    char:MoveTo(10,10,10)

end

script.Parent.Touched:connect(Touched)

2 comments

0

16:59:42.594 - MoveTo is not a valid member of Part Thats the error

0

MoveTo Is only for models.

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.

local coords = CFrame.new(0,10,0)

script.Parent.Touched:connect(function(hit)
	if hit then
		if hit.Parent then
			if hit.Parent:FindFirstChild('Humanoid') then
				if hit.Parent.Humanoid.Torso then
					hit.Parent.Humanoid.Torso.CFrame = coords
				end
			end
		end
	end
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).

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