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

How come my R15 Teleportation Script is not teleporting the players when they touch a brick?




function teleportPlayer(pos, torso)


	local char = torso


	char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))

end

function onTouched(part)
	if part.Parent ~= nil then
		local h = part.Parent:findFirstChild("Humanoid")
			if h~=nil then
				
				teleportPlayer(Vector3.new(-3087.8, 35.23, -7248.44) , part.Parent.UpperTorso) -- Change this to make it R6. 
                                          --Change the numbers above to the place you want to 
                                            --teleport people to.
			end			
	end
end

script.Parent.Touched:connect(onTouched)

It is not teleporting the players when they touch this brick.

3 comments

0

use the HumanoidRootPart not the Torso

0

try to use char.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(pos.X, pos.Y+7, pos.Z)) also :connect and :findFirstChild is deprecated. use :Connect and :FindFirstChild, if you want do make changes in char simple, on moment to send UpperTorso, only send HumanoidRootPart

0

Change char from Torso to LowerTorso

1 answer

✓ Accepted answer
local char = LowerTorso

R15 has several parts to a torso, so you have to clarify which part.

1 comment

0

The char is the player, and the player of the function is torso.

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