Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you make a custom weapon leaderboard compatible?

I don't know how to do this every time I kill somebody it only adds to the other person's death count and doesn't add any kills for the person who killed them I'm thinking I would have to add a creator tag or something I don't know. But this is a really important part for a game I'm making does anyone know if I need to add a creator tag or not, and if so then which line do I add it to? Here are the scripts for my weapon:

Script:

                                script.Parent.Handle.Touched:connect(function(p)

                                if script.Parent.CanDamage.Value == true then

                                script.Parent.CanDamage.Value = false

                                p.Parent.Humanoid:TakeDamage(3)
                                end
                                end)

LocalScript:

(ignore the grip part)

sp=script.Parent


originalgrip=CFrame.new(0,-1,.1)
 currentgrip=originalgrip
 function swordUp()
  currentgrip=originalgrip
  sp.Grip=currentgrip
end
function swordOut()
  currentgrip=originalgrip*CFrame.Angles(math.pi/4,.4,0)
  sp.Grip=currentgrip
end
                  function spinsword(spintime)
              delay(0,function()
	       local startspin=tick()
	       local endspin=startspin+spintime
	        while tick()<endspin do
		sp.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
		  wait()
	  end
	  sp.Grip=currentgrip
  end)
end
local CanAttack = true





script.Parent.Activated:connect(function()

local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)



if CanAttack == true then

attack:Play()

CanAttack = false

wait(1)

attack:Stop()

CanAttack = true

script.Parent.CanDamage.Value = true

end

end)

1 answer

In no part of your script did you show any attempt to add a kill to the respective person's leaderstats. I'd recommend looking at ROBLOX provided Game Assets, such as the LinkedSword and Leaderboard to see how they handle KOs.

This discussion is preserved as it was. New answers, comments, and votes are closed.