Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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)
0
Hello, I would like some more information. Is it a local script inside the textbutton? AntoninFearless 622 — 4y
0
No, it's a script inside the workspace. ISkyLordDoge 37 — 4y

1 answer

Log in to vote
0
Answered by
Arj783 72
4 years ago

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)
0
It still doesn't work. :/ ISkyLordDoge 37 — 4y
0
can i see your current code as well as a screenshot of the explorer where your gui and frames are? Arj783 72 — 4y
Ad

Answer this question