Hey guys,
I was just working on a boss battle that teleports you to another game when you touch a secret door. But the problem is, the touched event needs to be in a serverscript and the teleportservice needs to be in a localscript. What do I do?
Here is my code:
1 | local teleportservice = game:GetService( "TeleportService" ) |
2 | script.Parent.Touched:Connect( function () |
3 | teleportservice:Teleport( 5190764174 ) |
4 | end ) |
Thanks.
1 | local teleportservice = game:GetService( "TeleportService" ) |
2 | script.Parent.Touched:Connect( function (hit) |
3 | if game.Players:FindFirstChild(hit.Parent.Name) then |
4 | local plr = game.Players:FindFirstChild(hit.Parent.Name) |
5 | teleportservice:Teleport(plr, 5190764174 ) |
6 | end |
7 | end ) |
Lol.