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

Is This Teleportation Script Wrong?

I'm trying to make a script where if a Player clicked on a part(TeleDoor), it'd teleport them to another place:

game.Workspace.TeleDoor.onClicked.ClickDetector(
	game:GetService("TeleportService"):Teleport(154300059, 
		game.Players.LocalPlayer.Character)

)

I think this script is wrong, but then again, I don't because it doesn't have a red line under it... Help?

1 answer

Just because there is no red line doesn't mean that the script will be guaranteed to work.

This is a script inside the ClickDetector inside the 'TeleDoor'

local function onMouseClick(Player)
game:GetService("TeleportService"):Teleport(154300059,Player)
end
script.Parent.MouseClick:connect(onMouseClick)

2 comments

1

You're forgetting to index the ClickDetector's MouseClick event (the connection line)

0

Actually, I thought that it was a mistake so I changed it to Click Detector. I originally had MouseClick lol

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