How to fix "ResetOnSpawn" GUI appearing or not?

I am having trouble trying to make my GUI work, the objective is:

When there is a Winner in the IntValue, the GUI will show up with the name and avatar icon of the winner:

image

the problem is, when i let the ResetOnSpawn option of the GUI activated, it will work (atleast will show up but not hide it when there is no more Winner) but will reset whenever i spawn. And in the other hand, if i deactivate it, it won’t work at all.

Script:

local value = game.ReplicatedStorage.vals.Winner

local plrID = game.ReplicatedStorage.vals.Winner.WinnerID.Value

local Image = script.Parent

value:GetPropertyChangedSignal("Value")

if value.Value ~= "" then

script.Parent.Text = value.Value

script.Parent.ImageLabel.Image = "https://www.roblox.com/headshot-thumbnail/image?width=420&height=420&format=png&userId="..plrID

Image:TweenPosition(UDim2.new(0.739, 0, 0.407, 0))

else

Image:TweenPosition(UDim2.new(1, 0,0.407, 0))

script.Parent.Text = ""

script.Parent.ImageLabel.Image = ""

end

Idk if that is your complete code or not, but the problem is nothing happens when the value changes. So you have to connect via function

value:GetPropertyChangedSignal("Value"):Connect(function()
if value.Value ~= "" then
script.Parent.Text = value.Value
script.Parent.ImageLabel.Image = "https://www.roblox.com/headshot-thumbnail/image?width=420&height=420&format=png&userId="..plrID
Image:TweenPosition(UDim2.new(0.739, 0, 0.407, 0))
else
Image:TweenPosition(UDim2.new(1, 0,0.407, 0))
script.Parent.Text = ""
script.Parent.ImageLabel.Image = ""
end
end)
1 Like

Oh dayum, i thought of doing that but i didn’t, it worked thanks xD