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

Where should I put item ID/ Or the name in a code to give item after certain amount of kills?

I have some code and I'm wondering where I should put the item ID for the item I want to give, please help. For example, where would I put a magic Carpet ID

game.Players.PlayerAdded:connect(function(player)
	local folder = Instance.new("Folder",player)
	folder.Name = "leaderstats"
	local currency1 = Instance.new("IntValue",folder)
	currency1.Name = "Kills"
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(function()
			local tag = character.Humanoid:FindFirstChild("creator")
			if tag ~= nil then
				if tag ~= nil then
					local killer = tag.Value
					if killer ~= nil then
						-- Find the killer's leaderstats folder
						local killerStats = killer:FindFirstChild("leaderstats")
						if killerStats ~= nil then
							-- Find the killer's Kills IntValue
							local killerKills = killerStats:FindFirstChild("Kills")
							-- Increase Kills as before
							killerKills.Value = killerKills.Value + 1
							if killerKills.Value == 1 then
								game.Players.PlayerAdded:Connect(function(plr)
									plr:WaitForChild("Backpack")
									local cl = game.ReplicatedStorage.Tool:Clone()
									cl.Name = "Tool" --Where do I put it?
									cl.Parent = plr.Backpack
								end)
							end
						end
					end
				end
				if tag.Value ~= nil then
				end
			end
		end)
	end)
end)

7 comments

0

This is a follow up question to my most recent question.

0

i don't think you need to put a ID in your script

0

but i dont know whats wrong

0

Oh

0

But it doesn't give me Tool

0

Are you trying to make the tool, into a different tool?

0

no

1 answer

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