Will this work? If not what should I do?
local v = script.Parent.Parent local PlaceID = v.Portal.ID.Value function onTouched(hit) character = hit.Parent if character then game:GetService("TeleportService"):Teleport(PlaceID, character) end end script.Parent.Touched:connect(onTouched)
Here is my other script but if you can fix it then that would be great.
TeleDebounce1 = false local LPlayer = game.Players.LocalPlayer local BitsFrame = LPlayer.PlayerGui["_gui"] local character = LPlayer.Character for i,v in pairs(workspace.Portals:GetChildren()) do v.Portal.Touched:connect(function(Who) if Who.Parent:findFirstChild("Humanoid") and not TeleDebounce2 then TeleDebounce2 = true BitsFrame.Parent.TeleGui.Visible = true --Begin Functions local title = v.Portal.Title local img = v.Portal.Img local a = BitsFrame.Parent.TeleGui a:TweenPosition(UDim2.new(0.5, -150, 0.5, -200), "Out", "Quad", 0.5) a.Title.Text = title.Value a.Img.Image = img.Value BitsFrame.Parent.menuMusic:Pause() BitsFrame.Parent.teleGui:Play() wait(0.5) BitsFrame.Parent.menuMusic:Play() a:TweenPosition(UDim2.new(0, -300, 0.5, -200), "Out", "Quad", 0.5) game:GetService("TeleportService"):Teleport(v.Portal.ID.Value, character) --Close Gui wait(0.5) BitsFrame.Parent.TeleGui.Visible = false TeleDebounce2 = false end end) end
You can't call TeleportService on a character. Use it on a player: (v.Portal.ID.Value, LPlayer)