My script is supposed to display +, if there are multiple eliminations and 0 deaths, and - for when there are 0 eliminations and multiple deaths. My script is
01 | local player = game.Players.LocalPlayer |
02 | local leaderstats = player:WaitForChild( "leaderstats" ) |
03 | local elims = leaderstats:WaitForChild( "Eliminations" ) |
04 | local deaths = leaderstats:WaitForChild( "deaths" ) |
05 | local statisticsMenu = player.PlayerGui:WaitForChild( "statistics" ) |
06 | elims.Changed:Connect() |
07 | if leaderstats.Eliminations.Value > = 0 and |
08 | leaderstats.deaths.Value = = 0 then |
09 | player.PlayerGui.statistics.Frame.kdRatioNumber.Text = "+" |
10 | deaths.Changed:Connect() |
11 | if leaderstats.Eliminations.Value = = 0 and |
12 | leaderstats.deaths.Value > = 0 then |
13 | player.PlayerGui.statistics.Frame.kdRatioNumber.Text = "-" |
14 | end |
15 | end |
Shortly, you did ':Connect()' with the argument empty. There must be argument of 'function()' or you can call a function. Try to fix that; hope it was useful. Message me for further questions!
To make the .Changed event work, you need to do :Connect(function() not :Connect(), also, you made some mistakes on if statements. So your script will be like this:
01 | local player = game.Players.LocalPlayer |
02 | local leaderstats = player:WaitForChild( "leaderstats" ) |
03 | local elims = leaderstats:WaitForChild( "Eliminations" ) |
04 | local deaths = leaderstats:WaitForChild( "deaths" ) |
05 | local statisticsMenu = player.PlayerGui:WaitForChild( "statistics" ) |
06 | elims.Changed:Connect( function () |
07 | if leaderstats.Eliminations.Value > = 0 and |
08 | if leaderstats.deaths.Value = = 0 then |
09 | player.PlayerGui.statistics.Frame.kdRatioNumber.Text = "+" |
10 | end |
11 | end |
12 | end ) |
13 | deaths.Changed:Connect( function () |
14 | if leaderstats.Eliminations.Value = = 0 and |
15 | if leaderstats.deaths.Value > = 0 then |
16 | player.PlayerGui.statistics.Frame.kdRatioNumber.Text = "-" |
17 | end |
18 | end |
19 | end ) |
I hope this helped you! edit: Forgot to make :Connect(function() on deaths.Changed