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

aaaaaaaaaaaaaaaaaaaaaWhy my script won't work?

I want make kill for money script but it don't give me money if I kill someone Here is script:

function onPlayerEntered(newPlayer)
local stats = Instance.new ("IntValue")
stats.Name = "leaderstats"
stats.Parent = newPlayer
local Money = Instance.new ("IntValue")
Money.Name = "Money"
Money.Value = 0
Money.Parent = newPlayer.leaderstats
end

function handleKillCount(humanoid, player)
 local killer = getKillerOfHumanoidIfStillInGame(humanoid)
 if killer ~= nil then
  local stats = killer:findFirstChild("leaderstats")
  if stats ~= nil then
   local kills = stats:findFirstChild("Money")
   if killer ~= player then
    kills.Value = kills.Value + 10
    
   else
    kills.Value = kills.Value - 1
    
			end
		end
	end
end

game.Players.ChildAdded:connect(onPlayerEntered)

2 comments

0
  1. Don't put spam in your question's title: instead, try to be more descriptive of your issue in the title.
0
  1. You can edit your question post to include the getKillerOfHumanoidIfStillInGame function's code and where you're calling the handleKillCount function and any possible errors

1 answer

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