I have a script and it works fine in studio but in the developer logs in-game it says “Acessories is not a valid member of PlayerGui”
![]()
This is the full script:
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local hatUI = game.ServerStorage.BadgeHats
local BloxxerCapBadge = 3876863929533148
local function onPlayerAdded(player)
local success, hasBadge = pcall(BadgeService.UserHasBadgeAsync, BadgeService, player.UserId, BloxxerCapBadge)
if not success then
warn("Error while checking if player has badge")
return
end
if hasBadge then
print("has badge")
local bloxxerUI = hatUI.BloxxerCap:Clone()
print("cloned")
local PlayerGui = player:WaitForChild("PlayerGui")
print("giventoplayer1")
bloxxerUI.Parent = PlayerGui.Accessories.HatFrame.ScrollingFrame
print("giventoplayer2")
end
end
game.Players.PlayerAdded:Connect(onPlayerAdded)