Hi! I’m trying to have a gui pop out when a part is clicked. The problem I’m running into is after I close it, it will never come out ever again. I’m not sure why. Here’s my code.
local colorClone
script.parent.ClickDetector.MouseClick:connect(function(player)
if not player.PlayerGui:FindFirstChild("ColorPicker") then
colorClone=script.parent.ColorPicker:Clone()
colorClone.Parent = player.PlayerGui
colorClone.Frame:TweenPosition(UDim2.new(0.537, 0, 0.52, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.33, false)
colorClone.BackGround:TweenPosition(UDim2.new(0.338, 0, 0.25, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.33, false)
end
end
end)
That’s in a script. I know having it in a localscript is way easier but as I’m going to share it, I don’t want another thing they would have to move into a different place.
Here’s the close script. This one is in a localscript.
script.Parent.Activated:Connect(function()
pcall(function()
game:GetService("Players").LocalPlayer.PlayerGui.ColorPicker.Frame:TweenPosition(UDim2.new(0.537, 0, -1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.33, false)
game:GetService("Players").LocalPlayer.PlayerGui.ColorPicker.BackGround:TweenPosition(UDim2.new(0.338, 0, -1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.33, false)
wait(0.33)
game:GetService("Players").LocalPlayer.PlayerGui.ColorPicker:Destroy()
end)
end)
Any help would be appreciated! Thanks in advance!