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

How would I keep a value on an intvalue after the person dies?

Asked by 9 years ago

I have an intvalues and when someone presses one of the gui buttons it adds a value of one and the other button adds a value of two. How would I keep this value after they have died.

I'm trying to make a class gui where when someone presses a class it keeps the class after they have died and the round has started.

1 answer

Log in to vote
0
Answered by
Mystdar 352 Moderation Voter
9 years ago

Firstly this is not a request site, it is imperative you try everything first and post your problems here not requests. In future make sure that you research thoroughly, looking at the wiki, free models and other questions, this has been asked many times before. I shouldn't really give you any code at all since you haven't given any code. In order to keep Intvalues after a player dies you have to put it in the player (Game.Players) not the Character. I will only help you on putting an IntValue in the player. Use this script: (This is pretty much directly from the wiki too, you needed no prior experience to do this)

game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "leaderstats" -- Store all values in a model for organization

     local money = Instance.new("IntValue", leaderstats) --We create a new IntValue as a child of 'leaderstats'
     money.Name = "Class" --this is the name you want the leader-stat to be when it shows up in-game.
     money.Value = 0 --this is the value of money the new player starts out with. To change this, you can add some more code 
 end)

--And to change it you can do:
player.leaderstats.money.Value = 1 -- This will change the value to 1
-- Or simplier
money.Value = 1
Ad

Answer this question