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 4 years ago
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)
0
solved xTheodxre 16 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

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

Ad
Log in to vote
0
Answered by 4 years ago

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)

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)

Answer this question