Why can't I teleport people using TeleportService?
Will this work? If not what should I do?
01 | local v = script.Parent.Parent |
02 | local PlaceID = v.Portal.ID.Value |
04 | function onTouched(hit) |
05 | character = hit.Parent |
07 | game:GetService( "TeleportService" ):Teleport(PlaceID, character) |
11 | script.Parent.Touched:connect(onTouched) |
Here is my other script but if you can fix it then that would be great.
03 | local LPlayer = game.Players.LocalPlayer |
04 | local BitsFrame = LPlayer.PlayerGui [ "_gui" ] |
05 | local character = LPlayer.Character |
09 | for i,v in pairs (workspace.Portals:GetChildren()) do |
10 | v.Portal.Touched:connect( function (Who) |
11 | if Who.Parent:findFirstChild( "Humanoid" ) and not TeleDebounce 2 then |
13 | BitsFrame.Parent.TeleGui.Visible = true |
16 | local title = v.Portal.Title |
17 | local img = v.Portal.Img |
18 | local a = BitsFrame.Parent.TeleGui |
19 | a:TweenPosition(UDim 2. new( 0.5 , - 150 , 0.5 , - 200 ), "Out" , "Quad" , 0.5 ) |
20 | a.Title.Text = title.Value |
21 | a.Img.Image = img.Value |
22 | BitsFrame.Parent.menuMusic:Pause() |
23 | BitsFrame.Parent.teleGui:Play() |
25 | BitsFrame.Parent.menuMusic:Play() |
26 | a:TweenPosition(UDim 2. new( 0 , - 300 , 0.5 , - 200 ), "Out" , "Quad" , 0.5 ) |
27 | game:GetService( "TeleportService" ):Teleport(v.Portal.ID.Value, character) |
30 | BitsFrame.Parent.TeleGui.Visible = false |