Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

So I'm trying to work with leaderstats values, how can i do it?

Well, im trying to do an rpg game and in the leaderboard are three values: Power, Money and Magic. And every magic number is an element. Like 1 is fire, 2 is water, 3 is earth etc. . And here is the script that i was using, but it doesnt work! Im trying to do like:

if script.Parent.Parent.leaderstats.Magic.Value == 1 and script.Parent:findFirstChild("Fire") == nil then
         game.Lighting.Fire:clone().Parent = script.Parent
       end


But it doesnt work! Help!

1 comment

0

'Doesnt work' is too broad

1 answer

✓ Accepted answer
game.Players.PlayerAdded:connect(function(plr) -- player added
	local stats = Instance.new('IntValue',plr)
	stats.Name = 'leaderstats'
	
	local magic= Instance.new('StringValue',stats)
	magic.Name = "Magic" 
	magic.Value = "Earth"
end)

this leaderbord should work .

http://wiki.roblox.com/index.php?title=Leaderboard

this article will also help you under stand leaderbords a little bit to.

4 comments

0

But I also want the others value, what can i do

0

you can create a GUI that will change the local players magic value so when the players enter they can chose there magic.

0

nah i have another plan, but thanks so much for the answer

0

np good with your game

This discussion is preserved as it was. New answers, comments, and votes are closed.