I have made the following script, it needs to teleport the player from one world to another, however, it does not work. This script is a localscript. The reason for all of the different things is that the parts lie inside a model, named DannebrogStill.
local TeleportService = game:GetService("TeleportService") local placeID_1 = 751068488 local player = game.Players.LocalPlayer while true do game.Workspace.DannebrogStill.End.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Head.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Middle.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.NearMiddle.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Second.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Third.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Torso.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) end
Try this, if this doesnt work. Reply with the error.
local TeleportService = game:GetService("TeleportService") local placeID_1 = 751068488 local player = game.Players.LocalPlayer while wait() do game.Workspace.DannebrogStill.End.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Head.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Middle.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.NearMiddle.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Second.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Third.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) game.Workspace.DannebrogStill.Torso.Touched:Connect(function(part) if part.Parent.HumanoidPlayer then TeleportService:Teleport(placeID_1, player) end end) end
I suggest making it a script instead of local script. If you do, I think this code is what you are looking for.
(BTW this teleports the player to a place when they touch it. You will have to modify the gameID)
local TeleportService = game:GetService("TeleportService") local gameID = 3869185466 --put place id here function onTouched(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then TeleportService:Teleport(gameID, player) end end script.Parent.Touched:connect(onTouched)