Frame is not turning visible/transparent when I teleport

In this script I am trying to teleport to another block when you touch the teleporter, Everything works except for the gui turning visible, I dont know what the problem is and i’ve messed around with the script a lot.

local TeleportDestination = script.Parent.Parent.Teleporter2
local debounce = false
local TweenService = game:GetService('TweenService')
local Frame = game.StarterGui.TeleporterScreen.Frame

script.Parent.Touched:Connect(function(Hit)
	local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
	if Player and not debounce then
		local CurrentlyTeleporting = Player.Character:FindFirstChild("CurrentlyTeleporting")
		if not CurrentlyTeleporting then return end	

		if CurrentlyTeleporting.Value then
			TweenService:Create(
				Frame
				TweenInfo.new(2),
				{BackgroundTransparency = 1} 
			):Play() -- Plays your tween

			debounce = true
			CurrentlyTeleporting.Value = true
			Player.Character.HumanoidRootPart.CFrame = TeleportDestination.CFrame + Vector3.new(5,0,0)
			wait(3)
			CurrentlyTeleporting = false
			debounce = false
			

		end
	end
end)


Lines that are important: everything under CurrentlyTeleporting.Value then, this is where the problem occurs, no error messages or nothing, just nothing happens and you get teleported

What the gui looks like(from explorer)
Frame inside a screengui

You have Background Transparency set to 1. 1 makes it fully transparent. You said you wanted to make it visible, right? If so, then set that to zero, and it should work. I haven’t looked through all of your code, though, so there’s a chance there’s another error in your script. Try this, and see what happens.

Still doesnt work sadly, i’ll look through the script again

Wait, I think I got it. At the start of the script, your Frame variable is set to the gui in game.StarterGui. This is incorrect. This modifies the frame in startergui, but not the player’s gui. The players gui is located in player.PlayerGui.

You are a genius, This did work, very smart thinking

1 Like