This script with tweenposition that I was making to move a GUI when a button is clicked wont work? UPDATED Script: (I didnt show the whole script before)

--Made by club101coolguy

Player = game.Players.LocalPlayer
Button = script.parent
ButtonBacking = script.Parent.Parent:WaitForChild("ButtonBacking")
SnowTeleport = ButtonBacking:WaitForChild("TeleportButton")
SpawnTeleport = ButtonBacking:WaitForChild("TeleportButton2")
TheVisible = false

function Positioning()
	if TheVisible == false then
		ButtonBacking.Visible = true
		SnowTeleport.Visible = true
		SpawnTeleport.Visible = true
		ButtonBacking:TweenPosition(UDim2.new(0, 0, 0.55, 0), "Out", "Quad")
		Button.Text = "Did this work?"
		TheVisible = true
	elseif TheVisible == true then
		ButtonBacking.Visible = false
		SnowTeleport.Visible = false
		SpawnTeleport.Visible = false
		ButtonBacking:TweenPosition(UDim2.new(0, 0, 0.9, 0), "Out", "Quad")
	end
end
Button.MouseButton1Down:connect(Positioning)

5 comments

0

Looking at your code, the main problem is the Variable 'TheVisible'; You did not create a Variable anywhere named 'TheVisible', so, to Lua, it is taken as a 'nil value', and thus why your code doesn't work, also, please check the Output feature of the Studio 2.0, as it may tell you the error. :)

0

He just don't show all of his code, see he didnt declare the variables ButtonBacking, SnowTeleport, SpawnTeleport, Button

0

Taking another look at your code, when the GUIs become not Visible, 'TweenPosition' is transitioning the GUI to the same place, thus why it is not moving (line 13). :)

0

I declared the variables, and there were no errors in the output :).

0

hmm, lemme try to edit it a bit