01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local RemoteEvents = ReplicatedStorage.RemoteEvents |
03 |
04 | local Rebirth = RemoteEvents.Rebirth |
05 |
06 | Rebirth.OnServerEvent:Connect( function (player) |
07 | local Points = player.leaderstats.Points |
08 | local RebirthValue = player.leaderstats.Rebirth |
09 | local ClickBonus = player.Playerstats.ClickBonus |
10 | if Points.Value > = (RebirthValue.Value * 1000 ) then |
11 | Points.Value = 0 |
12 | Rebirth.Value = Rebirth.Value + 1 |
13 | ClickBonus.Value = ClickBonus.Value + 1 |
14 | end |
15 | end ) |
Try this :
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local RemoteEvents = ReplicatedStorage.RemoteEvents |
03 |
04 | local Rebirth = RemoteEvents.Rebirth |
05 |
06 | Rebirth.OnServerEvent:Connect( function (player) |
07 | local Points = player:WaitForChild( "leaderstats" ).Points |
08 | local RebirthValue = player:WaitForChild( "leaderstats" ).Rebirths |
09 | local ClickBonus = player.Playerstats.ClickBonus |
10 | if Points.Value > = (RebirthValue.Value * 1000 ) then |
11 | Points.Value = 0 |
12 | Rebirth.Value = Rebirth.Value + 1 |
13 | ClickBonus.Value = ClickBonus.Value + 1 |
14 | end |
15 | end ) |
You wrote Rebirth
but in your stats script you called it Rebirths
https://scriptinghelpers.org/questions/91410/why-do-i-have-a-nil-value-at-line-41-and-50
If you click on the link go to line 17,18,19 :D
Have a good day
You may just try this
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local RemoteEvents = ReplicatedStorage.RemoteEvents |
03 |
04 | local Rebirth = ReplicatedStorage.RemoteEvents.Rebirth |
05 |
06 | Rebirth.OnServerEvent:Connect( function (player) |
07 | local Points = player.leaderstats.Points |
08 | local RebirthValue = player.leaderstats.Rebirth |
09 | local ClickBonus = player.Playerstats.ClickBonus |
10 | if Points.Value > = (RebirthValue.Value * 1000 ) then |
11 | Points.Value = 0 |
12 | Rebirth.Value = Rebirth.Value + 1 |
13 | ClickBonus.Value = ClickBonus.Value + 1 |
14 | end |
15 | end ) |
This works properly if not Message me
01 | 01 local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | 02 local RemoteEvents = ReplicatedStorage.RemoteEvents |
03 | 03 local player = game:GetService( "Players" ) |
04 | 04 local Rebirth = RemoteEvents.Rebirth |
05 | 05 |
06 | 06 Rebirth.OnServerEvent:Connect( function () -- theres no need for a parameter just mention it |
07 | 07 local Points = player:WaitForChild( "leaderstats" ):WaitForChild( "Points" ) |
08 | 08 local RebirthValue = player:WaitForChild( "leaderstats" ):WaitForChild( "Rebirth" ) |
09 | 09 local ClickBonus = player.Playerstats.ClickBonus |
10 | 10 if Points.Value > = (RebirthValue.Value * 1000 ) then |
11 | 11 Points.Value = 0 |
12 | 12 RebirthValue.Value = RebirthValue.Value + 1 |
13 | 13 ClickBonus.Value = ClickBonus.Value + 1 |
14 | 14 end |
15 | 15 end ) |