I am trying to make my scrolling frame slide in but it doesn't work. Is this because it's a scrolling frame or just because of my script. If you want to see my script here it is:
mouse = game.Players.LocalPlayer:GetMouse() open = false script.Parent.MouseButton1Down:connect(function() if open == false then open = true script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,0.2,0),"In","Back",2,true) end if open == true then open = false script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,1,0),"Out","Linear",1,true) end end) mouse.KeyDown:connect(function(key) if key == "q" then if open == false then open = true script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,0.2,0),"In","Back",2,true) end if open == true then open = false script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,1,0),"Out","Linear",1,true) end end end)
Try this code below and see if it works. I changed it from 2 if
statements to one if
and elseif
statement. I also changed the if open == true
to if open
and if open == false
to if not open
due to it being easier to read (but it does the same exact thing). Let me know if this works and if it doesn't work, tell me the error.
mouse = game.Players.LocalPlayer:GetMouse() open = false script.Parent.MouseButton1Down:connect(function() if not open then open = true script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,0.2,0),"In","Back",2,true) elseif open then open = false script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,1,0),"Out","Linear",1,true) end end) mouse.KeyDown:connect(function(key) if key == "q" then if not open then open = true script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,0.2,0),"In","Back",2,true) elseif open then open = false script.Parent.Parent.Frame:TweenPosition(UDim2.new(0.3,0,1,0),"Out","Linear",1,true) end end end)