So I am making a game which I want to your Magic to be random when you level up, so I made a leaderboard for Level, Magic and Money like this:
game.Players.PlayerAdded:connect(function(p) local stats = Instance.new("IntValue") stats.Name = "leaderstats" stats.Parent = p
local nivel = Instance.new("IntValue") nivel.Name = "Level" nivel.Value = 1 nivel.Parent = stats local magia = Instance.new("IntValue") magia.Name = "Magic" magia.Value = 0 magia.Parent = stats local dinheiro = Instance.new("IntValue") dinheiro.Name = "Valis" dinheiro.Value = 0 dinheiro.Parent = stats
end)
I know this may sounds like a request but I want to know if magia.Value is 1 and if it is gives a tool of Lightning, if it is 2 gives another tool also in Lightning.
You'd have to detect when magia
is changed with the Changed() event. Then, you'd check if the value has changed to 1 or 2 with if-then and elseif-then statements, and if it has, you'd give the tool in the Lighting. Try putting this code under your magia code (at line 10, or anywhere before the end)
would be fine.)
magia.Changed:connect(function() --Changed Event if magia.Value == 1 then --if-then statement game.Lighting.ToolName.Parent = p.Backpack --Tool Giver. Change ToolName to the name of the tool. elseif magia.Value == 2 then --elseif-then statement game.Lighting.ToolName.Parent = p.Backpack --Again, change ToolName to the name of the tool. end end)
If it doesn't work, let me know. Make sure you change ToolName
at line 3 and 5 to the names of the tools.