Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is This Teleportation Script Wrong?

Asked by 10 years ago

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

Log in to vote
1
Answered by
Dummiez 360 Moderation Voter
10 years ago

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)
1
You're forgetting to index the ClickDetector's `MouseClick` event (the connection line) User#2 0 — 10y
0
Actually, I thought that it was a mistake so I changed it to Click Detector. I originally had MouseClick lol Dummiez 360 — 10y
Ad

Answer this question