Why is my UI not tweening after i pressed it and then closed it again? [Solved]

I want to achieve a simple popup frame that has a buy button, name, picture and a description.

The issue is that the first time: it works. but the second time it just doesnt.

I’ve tried making it server side and looked it up on a browser.

Server Script (in the part with clickdetector):

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.In) 
local ti2 = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.Out) 
local propertyToTween =  {Position = UDim2.new(0.17, 0,0.704, 0)}

local tweenInfo = TweenInfo.new(
	1, --Time
	Enum.EasingStyle.Back,
	Enum.EasingDirection.Out,
	0, --Repeat count
	false, --Reverse
	0 --Delay
)


script.Parent.ClickDetector.MouseClick:Connect(function(player)
	player.PlayerGui.ShopGui.Frame.ItemFrame.Visible = true
	player.PlayerGui.ShopGui.Frame.ItemFrame:WaitForChild("Title").Text = script.Parent.Name
	player.PlayerGui.ShopGui.Frame.ItemFrame:WaitForChild("Desc").Text = script.Parent.Parent.BurgerDescriptions.Value
	local tween = ts:Create(player.PlayerGui.ShopGui.Frame.ItemFrame, tweenInfo, {Position = UDim2.new(0.17, 0,0.704, 0)})
	tween:Play()
end)

Client Side Script (to close the frame in the StarterGui)

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.In) 
local ti2 = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.Out) 
local propertyToTween =  {Position = UDim2.new(0.17, 0,1.1, 0)}


script.Parent.MouseButton1Click:Connect(function()
	local tween = ts:Create(script.Parent.Parent, ti, propertyToTween)
	tween:Play()
	wait(1)
	script.Parent.Parent.Visible = false
	script.Parent.Parent:WaitForChild("Title").Text = "ItemName"
	script.Parent.Parent:WaitForChild("Desc").Text = "yummers!"
end)

Heres a video example:

Any help is appreciated!

if you change the visibility from client you can’t change it from server

use remote events to change visibility from client like the script below

--//server
script.Parent.ClickDetector.MouseClick:Connect(function(player)
	REMOTEEVENT:FireClient(player)
end)
--//client
REMOTEEVENT.OnClientEvent:Connect(function()
        script.Parent.Parent.Visible = true
        --// codes that you want to add
end)

this seems to have worked, thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.