Issue setting playergui to custom rig

as the title suggests im trying to make a specific player GUI visible whenever the players attribute (InMatch) is true, issue is that it detects that the attribute changed but wont make the GUI visible, it works perfectly when I’m using my normal character model but not the custom one

edit: I did some research could it be that the local scripts don’t work on a custom rig? i heard I am meant to give the rig player ownership? could someone elaborate

local plr = game:GetService("Players").LocalPlayer

local chr = plr.Character


chr:GetAttributeChangedSignal("InMatch"):Connect(function()
	local InMatch = chr:GetAttribute("InMatch")
	if InMatch == true then
		local playername = chr.Parent.playername.Value
		print(playername)
		print(chr)
		plr.PlayerGui.MainGui.MovesetUi.Visible = true
		print("in a match")
	else
		local playername = chr.Parent.playername.Value
		print(playername)
		print(chr)
		plr.PlayerGui.MainGui.MovesetUi.Visible = false
		print("Match Ended")
	end

end)

So you’re changing the player’s character?
What I’m guessing is happening is this order of events:

  1. you are connecting to the GetAttrributeChangedSignal
  2. You are changing the Player.Character to your custom rig
  3. Setting the InMatch attribute on this new Player.Character.

The issue would be that you connected to the GetAttributeChangedSignal on the old, original character that no longer exists. You aren’t listening for the InMatch attribute on the new character.

i hjave a button that changes the value of the (InMatch) attribute, I only press it after I morph into the other character, would that still be the issue, also I should have mention this before but no local scripts work while in the morphed character.

Yes, it would.
What matters the most is when the script with chr:GetAttributeChangedSignal("InMatch"):Connect(function() runs.
If it runs before you push the button then it’s still that old character that it’s watching.

So you need to make sure that after changing characters you’re setting up the connection for that attribute change on the new character.