First off, it's good practice to use HookScript instead of SetScript when adding script handlers to a foreign object, to avoid overriding the original script handler.
As for the issue, try HookScript "OnAttributeChanged" and check for the amount of players in the given group.
The visibility that you're trying to check for is always going to be true while you're in a raid, according to your visibility conditions "custom [group:raid] show; hide".
|