Proximity prompt used for teleporting wont work sometimes

I’m making a game and I have an in progress lobby system. You are meant to be able to interact with a proximity prompt in order to enter and exit a lobby. This is my current code

local enterprompt = game.Workspace.Walls["lobby wall"].Enterlobby
local leaveprompt = game.Workspace.Walls["lobby wall"].Leavelobby

enterprompt.Triggered:Connect(function(Player)
	Player.Character.HumanoidRootPart.Position = game.Workspace.Exit.gui.Position + Vector3.new(0,3,0)
	enterprompt.Enabled = false
	leaveprompt.Enabled = true
end)

leaveprompt.Triggered:Connect(function(Player)
	Player.Character.HumanoidRootPart.Position = game.Workspace.leavepart.Position
	enterprompt.Enabled = true
	leaveprompt.Enabled = false
end)

When entering it works, when I tested leaving for the first time it worked but when I anchored the destination part it didn’t work. Also when it did work entering wouldn’t work for a second time. I don’t know why this is happening. (I’m using gui as both a ui and a destination)

Boosing because I still need help.

Boosing again because no one has responded

Try to use CFrame instead of Position So it will look like this:

local enterprompt = game.Workspace.Walls["lobby wall"].Enterlobby
local leaveprompt = game.Workspace.Walls["lobby wall"].Leavelobby

enterprompt.Triggered:Connect(function(Player)
	Player.Character.HumanoidRootPart.CFrame = workspace.Exit.gui.CFrame + Vector3.new(0, 3, 0)
	enterprompt.Enabled = false
	leaveprompt.Enabled = true
end)

leaveprompt.Triggered:Connect(function(Player)
	Player.Character.HumanoidRootPart.CFrame = game.Workspace.leavepart.CFrame
	enterprompt.Enabled = true
	leaveprompt.Enabled = false
end)

I swear I used CFrame when I first made it but it didn’t work so I used position and it worked. Now I did something to make CFrame worked. Thank you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.