Unlocking system support needed

So I have made a game recently and want a system where if a player reaches x amount of kills then they get a weapon, how would I go about scripting this as I’m unsure, thank you in advance!

You can find the game here if it helps: Revolution [Early-Alpha] - Roblox

Use a .Changed event to check when the playerkill count changes, then, if it’s equal to the X amount of kills needed, give the weapon.

Kills.Changed:Connect(function()
if Kills.Value == 5 then
Tool.Clone.Parent = Player.Backpack
end)

It’s a simple code but you have to edit it by your own, from your game variables and stuff.

1 Like

I recommend using

local minkills = 5
local maxkills = 10

Kills.Changed:Connect(function()
 if Kills.Value >= minkills and Kills.Value <= maxkills then
  local tool = game.ServerStorage.Tool:Clone()
  tool.Parent = player.Backpack
 end
end)

since then it would also give it if your kills amount is greater than 5

1 Like

Add side value which is like “KillsForNextWepon” and just add it

then detect when it changes and if it reaches the ammount u want it to then give the player wepon

Value:GetPropertyChangedSignal("Value"):Connect(function)
      if Value.Value == number then
            local NewTool = Tool:Clone()
            NewTool.Parent = plr.Backpack
      end
end)

or u can use the normal value for kills and just

Value:GetPropertyChangedSignal("Value"):Connect(function)
      if Value.Value % 5 == 0 then -- will happen each time player reaches number which can devide by 5
            local NewTool = Tool:Clone()
            NewTool.Parent = plr.Backpack
      end
end)
1 Like

I have been researching for a while now but how do you see if a player killed another player? I am very unsure I may just be missing something simple but I have clue.

bullet.Touched:Connect(function(hit)
 if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health = 0 then --check if the touched player is dead
  --give them the reward
 end
bullet:Destroy() -- make sure it cant hit someone again
end)

if this works please mark it as a solution

1 Like