So im quite new to scripting and I just got the part of FindFirstChild and I'm attempting to make a stat that combines all the numbers of the other 3 stats Blue,Red and White but it gives the error in the title can someone help?And if there is another way of achieving what I want I would like to know.Here is my code:
1 | while wait() do |
2 | local player = game.Players.LocalPlayer |
3 | local estats = player:FindFirstChild( "stats" ) |
4 | local white estats:FindFirstChild( "White" ) |
5 | local red = estats:FindFirstChild( "Red" ) |
6 | local blue = estats:FindFirstChild( "Blue" ) |
7 | local all = estats:FindFirstChild( "All" ) |
8 | all.Value = blue.Value + red.Value + white.Value |
9 | end |
oh wait i think i see the problem, you forgot an equal sign i think in line 4 it says
1 | local white estats:FindFirstChild( "White" ) |
it should be
1 | local white = estats:FindFirstChild( "White" ) |
so i guess try this
01 | wait() --i always do this at the start of code or making variables |
02 | local player = game.Players.LocalPlayer |
03 | local estats = player:FindFirstChild( "stats" ) |
04 | local white = estats:FindFirstChild( "White" ) |
05 | local red = estats:FindFirstChild( "Red" ) |
06 | local blue = estats:FindFirstChild( "Blue" ) |
07 | local all = estats:FindFirstChild( "All" ) |
08 |
09 | while true do |
10 |
11 | wait() |
12 | all.Value = blue.Value + red.Value + white.Value |
13 |
14 | end |
i hope this helps :3