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: How to make a leaderboard that resets when they die.

Previous Thread :: Next Thread 
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:30 PM
print("Cash Stuffs running!")

function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

stats.Parent = newPlayer

local cash = Instance.new("IntValue")

cash.Name = "Points"
cash.Value = 0 --This sets the amount of money every player starts with

cash.Parent = stats

stats.Parent = newPlayer


end

game.Players.ChildAdded:connect(onPlayerEntered)

How do you make it reset when the humanoid dies?
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
05 Mar 2014 03:31 PM
It would go like this pseudocode:

player.CharacterAdded

leaderstat = 0
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:35 PM
Isn't player.CharacterAdded meaning when a player joins the game?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
05 Mar 2014 03:36 PM
Character added is when the players character resets/gets added to the game..

so using your playeradded script,and setting the players values to 0 with characteradded would work
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
05 Mar 2014 03:36 PM
Learn Lua
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:37 PM
Tried it, didn't turn out so well...
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:39 PM
@Island, I did add it, but where do I put it?


print("Cash Stuffs running!")

function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

stats.Parent = newPlayer

local cash = Instance.new("IntValue")

cash.Name = "Points"
cash.Value = 0

cash.Parent = stats

stats.Parent = newPlayer

end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
05 Mar 2014 03:39 PM
You tried to learn Lua and it didn't turn out well?
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:40 PM
No, I'd try to make my own scripts, end up getting the whole script with red wiggley lines and errors, I do try to fix scripts when I see them like:
Local i is supposed to be: local i
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 03:43 PM
Humanoid.Died

.Value = 0
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
05 Mar 2014 03:43 PM
wow,just wow...


print("Cash Stuffs running!")

function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

stats.Parent = newPlayer

local cash = Instance.new("IntValue")

cash.Name = "Points"
cash.Value = 0

cash.Parent = stats

stats.Parent = newPlayer

newPlayer.CharacterAdded:connect(function()
for I,v in pairs (plr.leaderstats:GetChildren()) do
v.Value = 0
end
end)
end
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
05 Mar 2014 03:44 PM
oop,not "plr"lol..

just edit it a bit
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:45 PM
Where is the error?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
05 Mar 2014 03:46 PM
completely fixed:

print("Cash Stuffs running!")

function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

stats.Parent = newPlayer

local cash = Instance.new("IntValue")

cash.Name = "Points"
cash.Value = 0

cash.Parent = stats

stats.Parent = newPlayer

newPlayer.CharacterAdded:connect(function(c)
for I,v in pairs (game.Players[c.Name].leaderstats:GetChildren()) do
v.Value = 0
end
end)
end
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:48 PM
I'm sure that it's supposed to work, but when I edited it to that -above-
It doesn't recognise, at all.
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:54 PM
Bump.
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
05 Mar 2014 03:57 PM
local function ClearStats(player)
player.Character.Humanoid.Died:connect(function()
player.leaderstats.Points.Value = 0
end)
end

game.Players.PlayerAdded:connect(ClearStats)
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 03:59 PM
Sorry, where does this go?
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 03:59 PM
ty azure
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
05 Mar 2014 04:00 PM
Maybe you should read the basics to studio on the wiki then watch the Lua tutorial by roblox on YouTube to try and learn Lua?
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
05 Mar 2014 04:06 PM
Sorry, where does it go?
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
06 Mar 2014 12:56 PM
Bump.
Report Abuse
wubbzy301 is not online. wubbzy301
Joined: 15 May 2010
Total Posts: 1188
06 Mar 2014 01:07 PM
function onDied()

backup = leaderstats:Clone()
leaderstats:Remove()

backup:Clone().Parent = player
end

player.Character.Humanoid.Died:connect(onDied)
Report Abuse
vvire is not online. vvire
Joined: 14 Feb 2014
Total Posts: 34
06 Mar 2014 01:14 PM
Is this a seperate script?
Report Abuse
wubbzy301 is not online. wubbzy301
Joined: 15 May 2010
Total Posts: 1188
06 Mar 2014 03:09 PM
function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

stats.Parent = newPlayer

local cash = Instance.new("IntValue")

cash.Name = "Points"
cash.Value = 0 --This sets the amount of money every player starts with

cash.Parent = stats

stats.Parent = newPlayer
player.Character.Humanoid.Died:connect(function ()

backup = stats:Clone()
backup.Points.Value = 0
stats:Remove()

backup:Clone().Parent = newPlayer
end)

end

game.Players.ChildAdded:connect(onPlayerEntered)
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