Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is rebirth not a valid member of folder on line 8?

Asked by 5 years ago
01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local RemoteEvents = ReplicatedStorage.RemoteEvents
03 
04local Rebirth = RemoteEvents.Rebirth
05 
06Rebirth.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
15end)
0
solved xTheodxre 16 — 5y

3 answers

Log in to vote
0
Answered by 5 years ago

Try this :

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local RemoteEvents = ReplicatedStorage.RemoteEvents
03 
04local Rebirth = RemoteEvents.Rebirth
05 
06Rebirth.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
15end)

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

Ad
Log in to vote
0
Answered by 5 years ago

You may just try this

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local RemoteEvents = ReplicatedStorage.RemoteEvents
03 
04local Rebirth = ReplicatedStorage.RemoteEvents.Rebirth
05 
06Rebirth.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
15end)
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

This works properly if not Message me

0101  local ReplicatedStorage = game:GetService("ReplicatedStorage")
0202  local RemoteEvents = ReplicatedStorage.RemoteEvents
0303  local player = game:GetService("Players")
0404  local Rebirth = RemoteEvents.Rebirth
0505  
0606  Rebirth.OnServerEvent:Connect(function() -- theres no need for a parameter just mention it
0707      local Points = player:WaitForChild("leaderstats"):WaitForChild("Points")
0808      local RebirthValue = player:WaitForChild("leaderstats"):WaitForChild("Rebirth")
0909      local ClickBonus = player.Playerstats.ClickBonus
1010      if Points.Value >= (RebirthValue.Value * 1000) then
1111          Points.Value = 0
1212          RebirthValue.Value = RebirthValue.Value + 1
1313          ClickBonus.Value = ClickBonus.Value + 1
1414      end
1515  end)

Answer this question