Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Exp on Kill and Over time script wont work?

Asked by 4 years ago
Edited 4 years ago

So i have a Leaderstat Called "Exp" but in the scripts its "EXP" im not sure if that matters but, The Exp on kill script doesnt work at all? Any help?

Exp on kill script:

game.Players.PlayerAdded:connect(function(player)
 local folder = Instance.new("Folder",player)
 folder.Name = "leaderstats"
 local currency1 = Instance.new("IntValue",folder)
 currency1.Name = "EXP"
 player.CharacterAdded:connect(function(character)
  character:WaitForChild("Humanoid").Died:connect(function()
  local tag = character.Humanoid:FindFirstChild("creator")
   if tag ~= nil then
    if tag.Value ~= nil then
     currency1.Value = currency1.Value + 300
    end
   end
  end)
 end)
end)

I also want a Exp over time script (for all players in the server) but my current script wouldnt work.

Exp over time script:

amount = 5
timedelay = 0.5
currencyname = "EXP"

while true do
 wait(timedelay)
 for i,v in pairs(game.Players:GetPlayers()) do
  if v:FindFirstChild("leaderstats") then
   v.leaderstats[currencyname].Value = v.leaderstats[currencyname]. Value + amount
  end
 end
end

0
I think your scripts needs to make sure that when you kill someone that it there is a string value named creator in order for it to work AlmostADemon 50 — 4y

Answer this question