Issues With Updating Guis Upon Respawn

Howdy.

I’m Bqttles, and I got an issue. I have a system where it changes an image icon based off a group’s thumbnail when the command is run. The problem though, is that upon resetting the image goes back to what i was before. Any help?

SCRIPTS:

Script (Server based)

local groupService = game:GetService("GroupService")
function getGroupIcon(id)
	return groupService:GetGroupInfoAsync(id).EmblemUrl
end

terminalValues.defendergroup.Event:Connect(function(sender, args)
	local link = getGroupIcon(args)
	local split = link:split("=")
	local id = split[2]
	terminalValues.Misc.TeamNames.DefenderId.Value = id
	terminalValues.Misc.defendergroupclient:FireAllClients(terminalValues.Misc.TeamNames.DefenderId.Value)
end)

LocalScript (Child of image Gui in question)

local id = game:WaitForChild("ReplicatedStorage").TerminalValues.Misc.TeamNames.DefenderId.Value
local plyr = game.Players.LocalPlayer

plyr.CharacterAdded:Connect(function(char)
	wait(1)
	plyr.PlayerGui.TerminalScreen.Score.DefendersLogo.Image = "http://www.roblox.com/asset/?id="..game.ReplicatedStorage.TerminalValues.Misc.TeamNames.DefenderId.Value
end)
game.ReplicatedStorage.TerminalValues.Misc.defendergroupclient.OnClientEvent:Connect(function()
	wait(1)
	plyr.PlayerGui.TerminalScreen.Score.DefendersLogo.Image = "http://www.roblox.com/asset/?id="..game.ReplicatedStorage.TerminalValues.Misc.TeamNames.DefenderId.Value
end)

Everything else executes perfectly, as the defendergroupid value doesn’t change immediately afterwards. I’m more confused as to anything.

82cf375c2ce1e778a97a6817063f3ae0

Just set the GUI’s ResetOnSpawn property to false.

1 Like

Thank you. Worked like a charm. You’re an awesome guy!