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

How can i make players teleport to another place when they click on something?

Asked by 6 years ago

In my left 4 dead, for the finale I have players surviving on a rooftop and they need to survive for 2 minutes before the helicopter arrives, when the helicopter arrives I want them to be teleported when they click the helicopter but its not working, can someone help?

What else would I have to put on here to make it work?

function(Onclick) if game.Workspace.Helicopter.ClickDetector.MouseClick=true game:GetService('TeleportService')

end
0
You want to look at the function which teleports the group of players to the same server. User#5423 17 — 6y
0
Do you want them to teleport do a different game server or another place inside the game? (Like teleport them from one position to another) User#19524 175 — 6y
0
another place inside the game bubyspp1 5 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
local TeleportService = game:GetService("TeleportService")
local PlaceID = 1818
local function MouseClick(Player)
    if Player then -- Not needed, just like it to be clean.
        TeleportService:Teleport(PlaceID, Player)
    end
end
script.Parent.ClickDetector.MouseClick:Connect(MouseClick)

Here's the script.

It's parented to a part with a ClickDetector in it.

0
i tried it but its not wanting to work :/ bubyspp1 5 — 6y
0
Are you trying to do it in Studio? Give me your current script. Ugh_Emily 25 — 6y
0
function Onclick() if game.Workspace.Helicopter.ClickDetector.MouseClick=true local TeleportService = game:GetService("TeleportService") local PlaceID = 1818 local function MouseClick(Player) if Player then -- Not needed, just like it to be clean. TeleportService:Teleport(PlaceID, Player) end end script.Parent.ClickDetector.MouseClick:Connect(MouseClick) bubyspp1 5 — 6y
Ad

Answer this question