I'm making a game where a player steps on a pad and it brings down a GUI code here:
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then -- if a humanoid exists, then local p = game.Players:FindFirstChild(part.Parent.Name) if p ~=nil then p.PlayerGui.MainGui.PetandTrail:TweenPosition(UDim2.new(0.5, -350, -0.5, -250), "Out", "Bounce", 1, false, nil) -- move the frame end end end script.Parent.Touched:connect(onTouch)
but, when the player closes out of the GUI, it doesn't open again, why is this?
code for closing the GUI:
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent.Open.Value = false script.Parent.Parent.Parent.Parent.PetandTrail:TweenPosition(UDim2.new(0.5, -350, -0.5, -1500),"Out","Bounce",1,true) end)