01 | game.Players.PlayerAdded:connect( function (player) |
02 | player.characteradded:Connect( function (char) |
03 | local data = Instance.new( "Folder" , player) |
04 | data.Name = "Stats" |
05 |
06 | local Strength = Instance.new( "IntValue" , data) |
07 | Strength.Name = "Strength" |
08 | Strength.Value = 0 |
09 |
10 | local Defense = Instance.new( "IntValue" , data) |
11 | Defense.Name = "Defense" |
12 | Defense.Value = 0 |
13 |
14 | local Agility = Instance.new( "IntValue" , data) |
15 | Agility.Name = "Agility" |
For this to work put a click detector inside the button.
1 | local button = script.Parent -- replace with the location of the button |
2 |
3 | button.ClickDetector.MouseClick:Connect( function (player) |
4 | player.Stats.Strength.Value = player.Stats.Strength.Value + 1 |
5 | player.Stats.Defense.Value = player.Stats.Defense.Value + 1 |
6 | player.Stats.Agility.Value = player.Stats.Agility.Value + 1 |
7 | player.Stats.Skill.Value = player.Stats.Skill.Value + 1 |
8 | end ) |
if it doesn't work tell me.
01 | wait() |
02 | local button = script.Parent |
03 | local player = game.Players.LocalPlayer |
04 | local stats = player:WaitForChild( "stats" ) |
05 | button.MouseButton 1 Click:Connect( function () |
06 | stats.Strength.Value = stats.Strength.Value + 1 |
07 | stats.Defense.Value = stats.Defe.Value + 1 |
08 | stats.Agility.Value = stats.Agility.Value + 1 |
09 | stats.Skill.Value = stats.Skill.Value + 1 |
10 | end ) |
?