How can I stop the script from adding hats?

Hello, I am having issues with my script, it is meant to add a hat to the player once they get a certain amount of points. It does its job but each time you gain points it continually adds hats instead of just adding one and I’m not sure how to go about stopping that.

local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local shaggy
local Players = game:GetService("Players")
local function playerAdded(player)
	local function check(value)
		if value >= 25 then
			
	
	
		
	
shaggy = Instance.new("Accessory")
shaggy.Name = "Shaggy"

local handle = Instance.new("Part")
handle.Name = "Handle"
handle.Size = Vector3.new(1,1.6,1)
handle.Parent = shaggy

local faceFrontAttachment = Instance.new("Attachment")
faceFrontAttachment.Name = "HatAttachment"
faceFrontAttachment.Position = Vector3.new(0.12, 0.4, -0.07)
faceFrontAttachment.Parent = handle

local mesh = Instance.new("SpecialMesh")
mesh.Name = "Mesh"
mesh.Scale = Vector3.new(1.07, 1.07, 1.07)
mesh.MeshId = "rbxassetid://19999424"
mesh.TextureId = "rbxassetid://20571982"
mesh.Parent = handle


humanoid:AddAccessory(shaggy)
		end
	end
	player.leaderstats.Robux.Changed:Connect(check)
	player.leaderstats.Robux = 25
end





for _, player in pairs(Players:GetPlayers()) do 
	playerAdded(player)

end

Try this and see if that works

if value >= 25 and not player.Character:FindFirstChild("Shaggy") then