generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Help with a leaderboard script please.

Previous Thread :: Next Thread 
TheWarriorOfPride is not online. TheWarriorOfPride
Joined: 07 Jul 2012
Total Posts: 4362
05 Aug 2014 05:00 AM
'Kay so basically, I want a certain Currency called Aurum to be given by kills, but only during official raids. Official raids being 5 people on the same team, which is Really red. So it only gives the currency (Aurum) when you kill in an official raid, (5 defenders on Really red team).
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
05 Aug 2014 05:30 AM
ok here i go

while true do
if hax + 8 == 1337 then
repeat until nil
end
repeat until nil
end

Report Abuse
Locard is not online. Locard
Joined: 13 Apr 2014
Total Posts: 3516
05 Aug 2014 07:53 AM
Pretty much you can just have a variable in a server script that depicts if the raid is official or not. When you're giving Aurum, just check if the "valid" variable is equal to 5 or not.


local valid = 0
game.Players.PlayerAdded:connect(function(newPlayer)
if newPlayer:IsInGroup(numbers) then
valid = valid + 1
newPlayer.TeamColor = BrickColor.new'Really red'
end end)

Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
05 Aug 2014 08:25 AM
local valid = workspace.Valid
game.Players.PlayerAdded:connect(function(newPlayer)
if newPlayer:IsInGroup(numbers) then
valid.Value = valid.Value + 1
newPlayer.TeamColor = BrickColor.new'Really red'
l = Instance.new("Model", newPlayer)
l.Name = "leaderstats"
k = Instance.new("IntValue", l)
k.Name = "Aurum"
k.Value = 0
end end)

Then in a localscript

local plr = game.Players.LocalPlayer

plr:WaitForChild("Character")

plr.Character.Humanoid.Died:connect(function()
if plr.Character.Humanoid:FindFirstChild("creator") ~= nil then
game.Players:GetPlayerFromCharacter(workspace:FindFirstChild(plr.Character.Humanoid.creator.Value)).leaderstats.Aurum.Value = game.Players:GetPlayerFromCharacter(workspace:FindFirstChild(plr.Character.Humanoid.creator.Value)).leaderstats.Aurum.Value + 1
plr.leaderstats.Aurum.Value
end
end
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
05 Aug 2014 08:27 AM
What you want to do is make a script with this code:

local valid = workspace.Valid
game.Players.PlayerAdded:connect(function(newPlayer)
if newPlayer:IsInGroup(numbers) then
valid.Value = valid.Value + 1
newPlayer.TeamColor = BrickColor.new'Really red'
l = Instance.new("Model", newPlayer)
l.Name = "leaderstats"
k = Instance.new("IntValue", l)
k.Name = "Aurum"
k.Value = 0
end end)

Then a localscript with this code:

local plr = game.Players.LocalPlayer

plr:WaitForChild("Character")

plr.Character.Humanoid.Died:connect(function()
if plr.Character.Humanoid:FindFirstChild("creator") ~= nil and workspace.Valid.Value > 5 then
game.Players:GetPlayerFromCharacter(workspace:FindFirstChild(plr.Character.Humanoid.creator.Value)).leaderstats.Aurum.Value = game.Players:GetPlayerFromCharacter(workspace:FindFirstChild(plr.Character.Humanoid.creator.Value)).leaderstats.Aurum.Value + 1
plr.leaderstats.Aurum.Value
end
end

and an intvalue in workspace named 'Valid'
Report Abuse
Locard is not online. Locard
Joined: 13 Apr 2014
Total Posts: 3516
05 Aug 2014 03:03 PM
Kodran you don't even need to make a physical value.
Report Abuse
Vescatur is not online. Vescatur
Joined: 18 Feb 2012
Total Posts: 3426
05 Aug 2014 03:09 PM
Wouldn't you need to, in order to link to the value with the localscript as well as the regular script?
Report Abuse
Locard is not online. Locard
Joined: 13 Apr 2014
Total Posts: 3516
06 Aug 2014 05:13 PM
Yes, but he wrote a lot of things locally, which he didn't need to in the first place. He also placed the end for the conditional statement in the wrong place, as well as forgetting to put closing parenthesis after an end.

local valid = 0
game.Players.PlayerAdded:connect(function(newPlayer)
if newPlayer:IsInGroup(numbers) then
valid = valid + 1
end
newPlayer.TeamColor = BrickColor.new'Really red'
l = Instance.new("Model", newPlayer)
l.Name = "leaderstats"
k = Instance.new("IntValue", l)
k.Name = "Aurum"
k.Value = 0
newPlayer.CharacterAdded:wait()

newPlayer.Character.Humanoid.Died:connect(function()
if newPlayer.Character.Humanoid:FindFirstChild("creator") ~= nil and valid > 5 then
game.Players:FindFirstChild(newPlayer.Character.Humanoid.creator.Value).leaderstats.Aurum.Value = game.Players:FindFirstChild(newPlayer.Character.Humanoid.creator.Value).leaderstats.Aurum.Value + 1
end
end)
end)

And all you have to do is put that in a server script and place that script in ServerScriptService.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
06 Aug 2014 05:17 PM
WOO1337
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image