script.Parent.Touched:Connect(function(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr.leaderstats.rebirth.Value >= 10 then
script.Parent.Transparency = .65
script.Parent.CanCollide = false
wait(.5)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end
end)
Why is rebirth not a valid member of folder on line 5?
4 answers
Is there another script making this NumberValue called "Rebirth" in the players?If Yes, you should check the script, if the script isnt changing the name of the NumberValue after putting it in the Player the NumberValue name will be "Value" so the game wont recognize it as "rebirth" but as "Value".
Try Changing the "rebirth" word at line 5 for "Value".If this works it means you gotta add a NumberValue.Name = "rebirth" to the other script- Or just leave it as it is, your choice.
6 comments
wut
Just replace the word "rebirth" at line 5 for Value and see if it works
wait wut? wdym
At the line 5 of your script theres a word called "rebirth", Check if it isnt spelled wrong or just replace it for the word "Value" and see if it works.
um ok, so change rebirth to value?
Yep
edited version of code (Fixed!)
script.Parent.Touched:Connect(function(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local leaderstats = plr:WaitForChild("leaderstats")
local rebirth = plr:WaitForChild("Rebirths")
if plr.leaderstats.rebirth.Value >= 10 then
script.Parent.Transparency = .65
script.Parent.CanCollide = false
wait(.5)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end
end)
3 comments
theres an infinite yield on line 6
pls help me
there try it
Hey, so I believe what went wrong here is you trying to index a value that doesn't yet exist. Instead, we can use another function in the script that will activate once a player joins, and insert the Rebirths into the player. Here's the full code.
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new('IntValue', player)
leaderstats.Name = 'leaderstats'
local Rebirths = Instance.new("IntValue", leaderstats)
Rebirths.Name = "Rebirths"
Rebirths.Value = 10
end)
script.Parent.Touched:Connect(function(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr.leaderstats.Rebirths.Value >= 10 then
script.Parent.Transparency = .65
script.Parent.CanCollide = false
wait(.5)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end
end)
If this helped, be sure to accept my answer!
2 comments
that screwed up my points for leaderstats
Then remove the upper function.. Please make sure you're spelling everything right, everything works on my end.
Hola. I'm going to do the best I can to help, but I don't think I can add anything more than what has already been brought to the table by other answers. So firstly, the error "'rebirth' is not a valid member of 'Folder' on line 5" essentially translates as "'rebirth' doesn't exist inside the folder" in casual English. This can either mean 1 of 2 things:
Possibility 1: 'rebirth' is Misspelled or Misnamed
Inside the "leaderstats" folder inside the player, there should already be an object called 'rebirth' according to your script. If you have renamed it in Studio, then the script will not work. Also, check for typos and capitalization just to be sure. If there is not an object titled 'rebirth' in the folder before the script is triggered, then it will throw this error in the console.
Possibility 2: 'rebirth' Doesn't Exist Yet
In this case, that means you haven't already created an object called 'rebirth' in the leaderstats folder. The script will throw this error in console because it is impossible to change something that does not exist. To do this, you would need to create the value "rebirth" before changing it. It would look something like this:
game.Players.PlayerAdded:Connect(function(plr)
local rebirth = Instance.new("IntValue", plr.leaderstats); --// Creates "rebirth" in LS.
rebirth.Name = "rebirth";
end)
script.Parent.Touched:Connect(function(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local rebirth = plr.leaderstats:WaitForChild("rebirth");
if rebirth.Value >= 10 then
script.Parent.Transparency = .65
script.Parent.CanCollide = false
wait(.5)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end
end)
I hope this helped. If neither of these solutions work, I am not sure what is wrong or how it could be fixed without seeing it myself. If you need any help, I will gladly help you in Team Create to fix your script if you desire. Best wishes :)
2 comments
rebirth line 11 is wrong, and leaderstats line 2 is wrong, idk wut to do now...
i can help you in team create if you want but that's about as much as I can do. sorry that i wasn't able to help :(
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Make sure you spelled rebirth right and the capitalization right. Should it be Rebirth or rebirth?
idk