youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:14 PM |
It's meant to award 1 point if you get 5, 10, 15 etc. KOs, for some reason it doesn't work...
local PointsService = Game:GetService("PointsService")
function awardPoint(Player) if PointsService:GetAwardablePoints() > 0 then PointsService:AwardPoints(Player.userId, 1) end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char) for i,v in pairs(Char.Humanoid:GetChildren()) do if v.Value.leaderstats.KOs.Value > 0 and v.Value.leaderstats.KOs.Value % 5 == 0 then awardPoint(v.Value) end return end end) end) |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:15 PM |
for i,v in pairs(Char.Humanoid:GetChildren()) do
You try to loop through all the children of their Humanoid which contains no leaderstats. |
|
|
| Report Abuse |
|
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:16 PM |
What do I do then? I didn't make this, someone made it for me on SH. |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:21 PM |
| Change it to Player.leaderstats instead of Char.Humanoid |
|
|
| Report Abuse |
|
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:22 PM |
local PointsService = Game:GetService("PointsService")
function awardPoint(Player) if PointsService:GetAwardablePoints() > 0 then PointsService:AwardPoints(Player.userId, 1) end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char) for i,v in pairs(Player.leaderstats) do if v.KOs.Value > 0 and v.KOs.Value % 5 == 0 then awardPoint(v.Value) end return end end) end) |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:22 PM |
| I think I made this and I think you changed it. |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:23 PM |
| I didn't say remove :GetChildren... |
|
|
| Report Abuse |
|
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:25 PM |
@Free, yeah, I think you did, I editted it because you were awarding 1 KO, as well as my leaderboard, so it was awarding double the KOs. @War, Ok, I'll fix it. |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:27 PM |
local PointsService = Game:GetService("PointsService")
function awardPoint(Player) if PointsService:GetAwardablePoints() > 0 then PointsService:AwardPoints(Player.userId, 1) end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char) Char.Died:connect(function() local killer = Char:FindFirstChild("creator") if killer and killer.Value and killer.Value.Parent and killer:FindFirstChild("leaderstats") and killer.leaderstats:FindFirstChild("KOs") then killer.Value.leaderstats.KOs.Value = killer.Value.leaderstats.KOs.Value+1 if killer.leaderstats.KOs.Value%5 == 0 then awardPoint(killer.Value) end end end) end) local leaderstats = Instance.new("Model", Player) leaderstats.Name = "leaderstats" local kills = Instance.new("IntValue", leaderstats) kills.Name = "KOs" end) |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:28 PM |
| That should work if you have a script that creates a leaderstats model then you'll want to delete it. If you want the script to use a leaderstats script you already have then I'll have to change it. |
|
|
| Report Abuse |
|
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:30 PM |
But would this work:
local PointsService = Game:GetService("PointsService")
function awardPoint(Player) if PointsService:GetAwardablePoints() > 0 then PointsService:AwardPoints(Player.userId, 1) end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char) for i,v in pairs(Player.leaderstats:GetChildren()) do if v.KOs.Value > 0 and v.KOs.Value % 5 == 0 then awardPoint(v.Value) end return end end) end) |
|
|
| Report Abuse |
|
|
| |
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:32 PM |
| Could you make it work with that way? |
|
|
| Report Abuse |
|
|
| |
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
| |
|
|
| 26 May 2014 04:34 PM |
| Well then how do you expect the Player to gain kills? |
|
|
| Report Abuse |
|
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:35 PM |
| Using the LinkedLeaderboard, the one that ROBLOX made. |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:36 PM |
local PointsService = Game:GetService("PointsService")
function awardPoint(Player) if PointsService:GetAwardablePoints() > 0 then PointsService:AwardPoints(Player.userId, 1) end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char) Char.Died:connect(function() local killer = Char:FindFirstChild("creator") if killer and killer.Value and killer.Value.Parent and killer:FindFirstChild("leaderstats") and killer.leaderstats:FindFirstChild("KOs") then if killer.leaderstats.KOs.Value%5 == 0 then awardPoint(killer.Value) end end end) end) end) |
|
|
| Report Abuse |
|
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 26 May 2014 04:36 PM |
| Ok, do you want to try it with me? |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:37 PM |
| Sure invite me to a party. |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 04:49 PM |
local PointsService = Game:GetService("PointsService")
function awardPoint(Player) if PointsService:GetAwardablePoints() > 0 then PointsService:AwardPoints(Player.userId, 1) end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char) Char:WaitForChild("Humanoid").Died:connect(function() if Char:FindFirstChild("Humanoid") then local killer = Char.Humanoid:FindFirstChild("creator") if killer and killer.Value and killer.Value.Parent and killer:FindFirstChild("leaderstats") and killer.leaderstats:FindFirstChild("KOs") then if killer.leaderstats.KOs.Value%5 == 0 then awardPoint(killer.Value) end end end end) end) end) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 May 2014 04:50 PM |
| FSM, why did you remove the check if KOs > 0... |
|
|
| Report Abuse |
|
|
|
| 26 May 2014 05:05 PM |
local PointsService = Game:GetService("PointsService")
function awardPoint(Player) if PointsService:GetAwardablePoints() > 0 then PointsService:AwardPoints(Player.userId, 1) end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char) Char:WaitForChild("Humanoid").Died:connect(function() if Char:FindFirstChild("Humanoid") then local killer = Char.Humanoid:FindFirstChild("creator") if killer and killer.Value and killer.Value.Parent and killer:FindFirstChild("leaderstats") and killer.leaderstats:FindFirstChild("KOs") and killer.leaderstats.KOs.Value > 0 then if killer.leaderstats.KOs.Value%5 == 0 then awardPoint(killer.Value) end end end end) end) end) |
|
|
| Report Abuse |
|
|