Hello,

I have set up 6 badges so that each 100 kills they get to level 1 then another badge for level 2 - 200 kills and so on... I have 6 badges along with 6 scripts in the workspace obviously, all the same script but each have a different badge ID Is it because there are too many scripts and I have to somehow combine them into one script?


~~~~~~~~~~~~~~~~~KillsForBadge=500
BadgeID=2124443488

function onHumanoidDied(humanoid,player)
	local killer=getKillerOfHumanoidIfStillInGame(humanoid)
	if killer~=nil then
		local kills=killer:findFirstChild("Kills")
		if killer~=player then
			kills.Value=kills.Value+1
			if kills.Value==KillsForBadge then
				local b=game:GetService("BadgeService")
				if b~=nil then
					b:AwardBadge(killer.userId,BadgeID)
				end
				local m=Instance.new("Message")
				m.Name="Achievment"
				m.Text="Achievment: "..tostring(KillsForBadge).." Kills"
				m.Parent=killer
				delay(7,function()
					if m~=nil then
						m:remove()
					end
				end)
			end
		else
			--kills.Value=kills.Value-1	
		end
	end
end

function onPlayerRespawn(property,player)
	if property=="Character" and player.Character~=nil then
		local humanoid=player.Character.Humanoid
		humanoid.Died:connect(function() onHumanoidDied(humanoid,player) end)
	end
end

function getKillerOfHumanoidIfStillInGame(humanoid)
	local tag=humanoid:findFirstChild("creator")
	if tag~=nil then
		local killer=tag.Value
		if killer.Parent~=nil then
			return killer
		end
	end
	return nil
end

function onPlayerEntered(newPlayer)
	local kills=Instance.new("IntValue")
	kills.Name="Kills"
	kills.Value=0
	kills.Parent =newPlayer
	while true do
		if newPlayer.Character~=nil then break end
		wait(5)
	end
	local humanoid=newPlayer.Character.Humanoid
	humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end)
	newPlayer.Changed:connect(function(property) onPlayerRespawn(property,newPlayer) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)~~~~~~~~~~~~~~~~~

6 comments

1

This is from a free model. Read the community guidelines before asking questions, specifically "Attempts should be your own work. Don't take a free model and expect us to fix it." https://scriptinghelpers.org/help/community-guidelines

0

bruh stop being the police with the guidlines

0

I have followed stickmasterlukes tutorials for months and have been studying hard while being a single father and doing a full time job, I don't steal or sponge off anyone.

0

lol no

0

Free model, read guidelines.

0

Eh no, you definitely didn't make this. This is an old FM script, it still uses "connect" and "userId". Definitely seen this before.