So i have this Fruit Stall, when ever you walk up to the front part and touch it a GUI will pop up on your screen with a few food items on it and when you click close the GUI will disappear. However, Its not been working the way I've intended it to so, not even touching the part can open the GUI sometimes, the closing animation works about half the time, also I've been finding that when you walk up to the stand and touch the part the closing animation will work and not the opening animation.
Here is my code:
local stall = game.Workspace.FoodStand.FrontPart
local screenUI = script.Parent
local FoodStallGUI = script.Parent.Gradient
local foodItems = script.Parent.Parent
local frame = script.Parent.Frame
screenUI.Enabled = false
foodItems.Enabled = false
stall.Touched:Connect(function()
screenUI.Enabled = true
foodItems.Enabled = true
frame.Size = UDim2.new(0, 1479,0, 351)
frame:TweenPosition(
UDim2.new(0.09, 0,0.366, 0), -- End Position
"In", -- Easing Direction
"Linear", -- Easing Style
1, -- Time in Seconds
false
)
FoodStallGUI:TweenPosition(
UDim2.new(0.122, 0, 0.139, 0), -- End Position
"Out", -- Easing Direction
"Quint", -- Easing Style
1, -- Time in Seconds
false
)
end)
Here is my Button Code:
local button = script.Parent
local frame = game.Players.LocalPlayer.PlayerGui.ScreenGUI.FruitStall.Gradient -- Foods
local FoodStallGUI = game.Players.LocalPlayer.PlayerGui.ScreenGUI.FruitStall.Frame
local t = game.Players.LocalPlayer.PlayerGui.ScreenGUI.FruitStall -- Background
button.MouseButton1Click:Connect(function()
print("Attempted to close")
FoodStallGUI:TweenPosition(
UDim2.new(0.09, 0,0, 0),
"In", -- Easing Direction
"Linear", -- Easing Style
1, -- Time in Seconds
false
)
frame:TweenPosition(
UDim2.new(0.106, 0,-0.545, 0),
"In", -- Easing Direction
"Linear", -- Easing Style
1, -- Time in Seconds
false
)
t.Enabled = false
print("closed")
end)
Here is my explorer: Explorer Image
Here is my GUI: GUI Image
My GUI glitching out and opening with closing animation: GUI Glitch

1 comment
ALSO just realised that randomly the GUI just pops up, without even touching it. You could be on the other side of the map and it just pops up lol