Why does my gui script not work

  1. What do you want to achieve? Keep it simple and clear!
    When the player clicks a part, the ui appears from the left side of the screen, and travels to the right.
  2. What is the issue? Include screenshots / videos if possible!
    My script does not do anything
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    DevForum
local Handle = script.Parent
local ClickD = Handle.ClickDetector
local Tele = Handle.Parent.Parent.Tele
local LoadScreen = game.StarterGui.DoorTeleport.Frame

ClickD.MouseClick:Connect(function(plr)
	LoadScreen:TweenPosition(UDim2.new(0.5,0,0.5,0),"InOut","Quad", 1, true)
	wait(1)
	LoadScreen:TweenPosition(UDim2.new(-0.5,0,0.5,0),"InOut","Quad", 1, true)
	wait(1)
	plr.Character:MoveTo(game.Workspace.Tele.Position)
end)


you need to change the gui in the players PlayerGui not StarterGui

local Handle = script.Parent
local ClickD = Handle.ClickDetector
local Tele = Handle.Parent.Parent.Tele

ClickD.MouseClick:Connect(function(plr)
	local LoadScreen = plr.PlayerGui.DoorTeleport.Frame
	
	LoadScreen:TweenPosition(UDim2.new(0.5,0,0.5,0),"InOut","Quad", 1, true)
	wait(1)
	LoadScreen:TweenPosition(UDim2.new(-0.5,0,0.5,0),"InOut","Quad", 1, true)
	wait(1)
	plr.Character:MoveTo(game.Workspace.Tele.Position)
end)
1 Like

I will just improve your solution. Use the new/old task library.

task.wait(1)

Why? The task library allows for functions and threads to be scheduled with the Task Scheduler than just the basic wait(), Also it will just improve performance

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