✓ Accepted answer
This happens sometimes due to the fact that the script loads before the actual other descendants of the gui. Until they load, they're considered nil. To prevent this, you could either use the WaitForChild method, which you can read more about here, to wait until the specified frames have loaded. Or you could just add a wait(2) at the top of your script. The latter is less reliable but doesn't take as many lines.
script.Parent.Parent.Parent:WaitForChild("Join")
script.Parent.Parent.Parent:WaitForChild()
local GUI = script.Parent.Parent
local GUI2 = script.Parent.Parent.Parent:FindFirstChild("Join")
script.Parent.MouseButton1Down:connect(function(click)
print(game.Players.LocalPlayer.Name..' is now being Teleported..')
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)
wait(1)
GUI2:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Quad", 2)
end)
Or..
wait(2)
local GUI = script.Parent.Parent
local GUI2 = script.Parent.Parent.Parent:FindFirstChild("Join")
script.Parent.MouseButton1Down:connect(function(click)
print(game.Players.LocalPlayer.Name..' is now being Teleported..')
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)
wait(1)
GUI2:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Quad", 2)
end)
1 comment
Can you take a pic of where the script is located?