so i planning to make a "Rick and Morty" portal gun that allow me to create a "Teleport pad" that will make me to teleport to another game if i click the portal. so i wrote this scripts on the tool i made
portal = false
function clicked()
if portal == false then
portal = true
local wormhole = Instance.new("Part")
wormhole.Anchored = true
wormhole.Parent = workspace
wormhole.Name = "Hole"
wormhole.Size = Vector3.new(5, 5, 1)
wormhole.BrickColor = BrickColor.new("Lime green")
wormhole.CFrame = script.Parent.Handle.CFrame
local enter = Instance.new("ClickDetector")
enter.Parent = game.Workspace.Hole
wait(5)
game.Workspace.Hole:remove()
portal = false
end
end
script.Parent.Activated:connect(clicked)
function tp(player)
if portal == true then
game:GetService("TeleportService"):Teleport(938093581,player)
end
end
game.Workspace.Hole.ClickDetector.MouseClick:connect(tp)
so it create a portal but i cant teleport to the place that i want to visit. is something wrong with my script?.

3 comments
Does the worm hole get created?
yes but it cant teleport me to other place/game
Did my script work?