Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't my tweening work? I tried fixing it several times.

I made a tweening so I could open and close my team gui like a shop gui, but it won't work. Why? Much appreciated for help.

local mainFrame = game:GetService("StarterGui").teamGUI.MainFrame
local visibilityBtn = game:GetService("StarterGui").teamGUI.MainFrame.visibilityBtn

visibilityBtn.MouseButton1Click:Connect(function()
	if mainFrame.Position == UDim.new(0.5,0,0.5,0) then
		mainFrame:TweenPosition(UDim2.new(-0.16,-3,0.5,0), "In Out", "Sine")
		visibilityBtn.Text = "CLOSE"
	end
	if mainFrame.Position == UDim.new(-0.16,-3,0.5,0) then
		mainFrame:TweenPosition(UDim2.new(0.5,0,0.5,0), "In Out", "Sine")
		visibilityBtn.Text = "OPEN"
	end
end)

2 comments

0

Hello, I would like some more information. Is it a local script inside the textbutton?

0

No, it's a script inside the workspace.

1 answer

You shouldn't do StarterGUI. All items in StarterGUI go directly into a player's PlayerGui. I recommend you put the script in the frame or button and change it to stuff like -

local visibilityBtn = script.Parent
visibilityBtn.MouseButton1Click:Connect(function()
          -- Code
end)

2 comments

0

It still doesn't work. :/

0

can i see your current code as well as a screenshot of the explorer where your gui and frames are?

This discussion is preserved as it was. New answers, comments, and votes are closed.