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

i was trying to make teleporters but they dont work?

heres the script local T1 = game.Workspace.Teles.T1 local T2 = game.Workspace.Teles.T2 function tele(Part) local hum = Part.Parent:findFirstChild("Humanoid") if (hum ~= nil) then hum.Torso.CFrame = CFrame.new(T2.Position+Vector3(0,3,0) end end

3 comments

0

i dont know why but the script in the description messed up and it looks weird

0

put this in a code block, this is unreadable

0

bruh i did but the site messed it up

1 answer

✓ Accepted answer

If I've read this right, it should be something like this:

-- teleport variables 
local Teleport1 = workspace.Teles.T1
local Teleport2 = workspace.Teles.T2

Players = game:GetService('Players')

Teleport1.Touched:Connect(function(otherPart) -- touched function
	if otherPart.Parent:FindFirstChildOfClass('Humanoid') ~= nil then -- potential player
		local player = Players:GetPlayerFromCharacter(otherPart.Parent) -- player from character
		if player then -- if player
			player.Character.HumanoidRootPart.CFrame = Teleport2.CFrame + Vector3.new(0,2,0) -- added Y axis + 2 to prevent being TPed into the ground/teleport.
		end
	end
end)

2 comments

0

i already found the error i didnt do vector3.new

0

but still thanks

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