This is what I have, and in the output Im receiving a message that apparently it doesn't like/ accept the phrase "AccessoryId." Has this recently been replaced? What should I do. This is a hat giver btw
```lua local PlayersService = game:GetService("Players") part=script.Parent AccessoryId=part.Parent['AccessoryId'].Value --Do not change TimeOut=part.Parent['TimeOut'].Value --Do not change part.Touched:Connect(function(hit) if PlayersService:GetPlayerFromCharacter(hit.Parent) then --Confirm player is real, and not a NPC.
local newhat=game:GetService('InsertService'):LoadAsset(AccessoryId) for _,v in pairs (newhat:GetChildren()) do if v:IsA("Accessory") then if hit.Parent:FindFirstChild(v.Name) then v:Destroy()
elseif givehat then v.Parent=hit.Parent while wait() do ---[[Delete hat if not in workspace if v.Parent~=hit.Parent then v:Destroy()
end end ---]] end end end end end)
part.Touched:Connect(function(hit) if not deb then deb=true else return nil end if PlayersService:GetPlayerFromCharacter(hit.Parent) then part.CFrame=part.CFrame + Vector3.new(0,-0.25,0) part.BrickColor=BrickColor.new("Really red") givehat=true part.Sound:Play() wait(0.5) givehat=false part.CFrame=part.CFrame + Vector3.new(0,0.25,0) part.BrickColor=BrickColor.new("Bright green") end
wait(TimeOut) givehat=true deb=false end) ```