so i have these telporters in my game and they teleport you to a level i want it so when you touch them a loading ui will apear which i have made im just not sure how to make it fade out but i want it that the ui apears then after 2 seconds the player gets teleported and then the ui fades out so you cant see yourself getting teleported then a cutscene plays but the problem is that theres 2 teleporters that both teleport you back and forth between levels so when you teleport it just teleports you back how would i stop this from happening such as a debounce or something
i was also thinking of just adding 1 portal and a pause menu to leave the level
-- local Teleport = "CutsceneTouch2"
function Touch (hit)
wait(2)
if script.Parent.Locked == false and script.Parent.Parent : FindFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:FindFirstChild(Teleport).Locked=true
local Pos = script.Parent.Parent:FindFirstChild(Teleport)
hit.parent:moveTo(Pos.Position) wait(1)script.Parent.Locked = false script.Parent.Parent:FindFirstChild(Teleport).Locked = false
end
end
script.Parent.Touched:connect(Touch)