local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage.RemoteEvents
local Rebirth = RemoteEvents.Rebirth
Rebirth.OnServerEvent:Connect(function(player)
local Points = player.leaderstats.Points
local RebirthValue = player.leaderstats.Rebirth
local ClickBonus = player.Playerstats.ClickBonus
if Points.Value >= (RebirthValue.Value * 1000) then
Points.Value = 0
Rebirth.Value = Rebirth.Value + 1
ClickBonus.Value = ClickBonus.Value + 1
end
end)
COMMUNITY QUESTION
Why is rebirth not a valid member of folder on line 8?
3 answers
Try this :
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage.RemoteEvents
local Rebirth = RemoteEvents.Rebirth
Rebirth.OnServerEvent:Connect(function(player)
local Points = player:WaitForChild("leaderstats").Points
local RebirthValue = player:WaitForChild("leaderstats").Rebirths
local ClickBonus = player.Playerstats.ClickBonus
if Points.Value >= (RebirthValue.Value * 1000) then
Points.Value = 0
Rebirth.Value = Rebirth.Value + 1
ClickBonus.Value = ClickBonus.Value + 1
end
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
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage.RemoteEvents
local Rebirth = ReplicatedStorage.RemoteEvents.Rebirth
Rebirth.OnServerEvent:Connect(function(player)
local Points = player.leaderstats.Points
local RebirthValue = player.leaderstats.Rebirth
local ClickBonus = player.Playerstats.ClickBonus
if Points.Value >= (RebirthValue.Value * 1000) then
Points.Value = 0
Rebirth.Value = Rebirth.Value + 1
ClickBonus.Value = ClickBonus.Value + 1
end
end)
This works properly if not Message me
01 local ReplicatedStorage = game:GetService("ReplicatedStorage")
02 local RemoteEvents = ReplicatedStorage.RemoteEvents
03 local player = game:GetService("Players")
04 local Rebirth = RemoteEvents.Rebirth
05
06 Rebirth.OnServerEvent:Connect(function() -- theres no need for a parameter just mention it
07 local Points = player:WaitForChild("leaderstats"):WaitForChild("Points")
08 local RebirthValue = player:WaitForChild("leaderstats"):WaitForChild("Rebirth")
09 local ClickBonus = player.Playerstats.ClickBonus
10 if Points.Value >= (RebirthValue.Value * 1000) then
11 Points.Value = 0
12 RebirthValue.Value = RebirthValue.Value + 1
13 ClickBonus.Value = ClickBonus.Value + 1
14 end
15 end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
solved