How can I make it so that hitting a player grants an achievement?

so far it hasnt worked, i hope it does soon

so the code didnt work, here’s the current code

local BadgeService = game:GetService("BadgeService")
local BadgeId = 2125960837 -- your badgeid
local owner = "IAmOof_D"
local debounce = false

script.Parent.Touched:Connect(function(hit)
	if script.Parent.Parent.Parent:FindFirstChild("Backpack") then
		local yourplayer = script.Parent.Parent.Parent
		if game.Players:GetPlayerFromCharacter(hit.Parent) then
			local otherplayer =game.Players:GetPlayerFromCharacter(hit.Parent)
			if otherplayer.Name == owner then
				BadgeService:AwardBadge(yourplayer.UserId, BadgeId)
				local confetti = game.ServerStorage.confettipart:Clone()
				confetti.Parent = workspace
				confetti.Position = yourplayer.Torso.Position
				confetti.ParticleEmitter:Emit(30)
				confetti["Achievement"]:Play()
			end
		end
	end
end)

hang on, i think i might have an idea

local BadgeService = game:GetService("BadgeService")
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")

local BadgeId = 2125960837
local owner = "IAmOof_D"

local handle = script.Parent
local tool = handle.Parent

handle.Touched:Connect(function(hit)
if PS:GetPlayerFromCharacter(tool.Parent) then
		local clientplayer = Players:GetPlayerFromCharacter(tool.Parent)
		if Players:GetPlayerFromCharacter(hit.Parent) then
			local serverplayer = Players:GetPlayerFromCharacter(hit.Parent)
			if serverplayer.Name == owner then
				BadgeService:AwardBadge(clientplayer.UserId, BadgeId)
				local confetti = ServerStorage.confettipart:Clone()
				confetti.Parent = workspace
				confetti.Position = clientplayer.Torso.Position
				confetti.ParticleEmitter:Emit(30)
				confetti["Achievement"]:Play()
			end
		end
end
end)

thought of a potential idea, gonna test now
this is parented in startercharacterscripts

local chr = script.Parent
local BadgeService = game:GetService("BadgeService")
local yourplr = game.Players:GetPlayerFromCharacter(chr)
function donk(whodunnit)
	if yourplr.UserId == 68496730 then
	if whodunnit.Name == "Sledgehammer Head" then
			local otherplr = game.Players:GetPlayerFromCharacter(whodunnit.Parent.Parent)
			BadgeService:AwardBadge(otherplr.UserId,2125960837)
			local confetti = game.ServerStorage.confettipart:Clone()
			confetti.Parent = workspace
			confetti.Position = whodunnit.Parent.Parent.Torso.Position
			confetti.ParticleEmitter:Emit(30)
			confetti["TF2 Achievement Earned"]:Play()
end
	end
	end
chr.Torso.Touched:Connect(donk)

got solved lol