Not a valid member of Player

Yes, and check if something is not deleting the file after it being found

Can you send the full script(s)? I don’t believe the error is being returned by the script you’re actually editing, as aforementioned, it should be returned as infinite yield if it doesn’t exist.

After you changed your script to the suggested edits, the error was still there, making me believe you have more than one script attempting to reference the folder.

Server Script

--variables
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local ValueDB = DataStoreService:GetDataStore("Charred_Datastore")

--functions
local function saveData(Player)
	local Values = {
		Player.XPstuff.Level.Value;
		Player.XPstuff.Exp.Value;
	}
	pcall(function()
		ValueDB:SetAsync(Player.UserId, Values)
	end)
end




local function PlayerAdded(Player)
	wait(2)
	--setup
	local data
	
	local s, e = pcall(function()
		data = ValueDB:GetAsync(Player.UserId)
	end)
	
	if not s then warn(e) end
	
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "XPstuff"
	leaderstats.Parent = Player
	
	local Level = Instance.new("NumberValue",leaderstats)
	Level.Name = "Level"
	
	local Exp = Instance.new("NumberValue",leaderstats)
	Exp.Name = "Exp"
	
	local RequiredExp = Instance.new("NumberValue", Player)
	RequiredExp.Name = "RequiredExp"
	RequiredExp.Value  = Level.Value * 100
	
	if data and data[1] then
		Level.Value = data[1]
	else
		Level.Value = 1
	end
	
	if data and data[2] then
		Exp.Value = data[2]
	else
		Exp.Value = 0
	end
	
	
	--maincode
	Exp.Changed:Connect(function(Changed)
		if Exp.Value>= RequiredExp.Value then
			Exp.Value = 0
			Level.Value += 1
			RequiredExp.Value = Level.Value * 100
			
			
			
		end
	end)
end



local function PlayerRemoving(Player)
	saveData(Player)
end

for _, Player in ipairs(Players:GetPlayers()) do
	PlayerAdded(Player)
end

Players.PlayerAdded:Connect(PlayerAdded)
Players.PlayerRemoving:Connect(PlayerRemoving)

Local Script

task.wait()
local Player = game.Players.LocalPlayer
local Xpstuff = Player:WaitForChild('XPstuff')
local Exp = Xpstuff.Exp
local RequiredExp = Player.RequiredExp

Exp.Changed:Connect(function(Changed)
if Changed then
script.Parent.XPBar.Bar:TweenSize(UDim2.new(Exp.Value/ RequiredExp.Value,0,1,0))
end
end)
while task.wait() do
script.Parent.Percent.Text = Exp.Value.."/"..RequiredExp.Value
end

perhaps do

repeat
task.wait()
until game.Players.LocalPlayer:FindFirstChild("XPstuff")
local Folder = game.Players.LocalPlayer:FindFirstChild("XPstuff")

or do

game.Players.LocalPlayer.ChildAdded:Connect(function(child)
if child.Name == "XPstuff" then
-- Your script
end end)

the above but without delaying anything

game.Players.LocalPlayer.ChildAdded:Connect(function(child)
if child.Name == "XPstuff" then
spawn(function()
-- Your script
end) end end)

if none of the above work then really its a problem with the name
make sure to check that there are no spaces or diffrent characters (rewrite the name)


Edit : I found the reason it doesnt work because

this has a 2 second delay (the server script)
and the local script

has only 0.01 seconds (somewhere there)
you dont need a delay on the server script unless that really is until player is fully loaded but im sure there is no use since nothing is covering with character so…
yeah.

That shouldn’t happen. When the game errors with :WaitForChild() It will say something about infinite wait. This probably means you have either the wrong script, or you didn’t commit the script.

its infinite yield but i found out that this is a delay issue check the scripts he posted.

Yeah I removed the wait before in the server script and still got the issue.

did you try the things i said?

Yep, I’ve checked the name and everything. So confused why this isn’t working, never had this before.

no i mean the methods. have you tried them yet? (on local script btw)

Yes, I’ve tried these. (charrrrs)

I’ve had an issue like this before in the past.
Check out this post. This fixed my issues

Yeah I looked that that. This is where I’m very confused as the folder is being made, it just says it’s not a member of the player when it is. Been using this method for ages and never experienced this.

could you give me a file of those 2 scripts so i can test them myself?

This is a very weird bug. It also happened to me before.

Code’s a couple of posts above.

simply enough i had no errors?
only thing i did is this

task.wait(0.1)

local Player = game.Players.LocalPlayer

local Xpstuff = Player:WaitForChild('XPstuff')

local Exp = Xpstuff.Exp

local RequiredExp = Player.RequiredExp

Exp.Changed:Connect(function(Changed)

if Changed then

script.Parent.XPBar.Bar:TweenSize(UDim2.new(Exp.Value/ RequiredExp.Value,0,1,0))

end

end)

while task.wait() do

script.Parent.Percent.Text = Exp.Value.."/"..RequiredExp.Value

end

local script top
server script down

--variables
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local ValueDB = DataStoreService:GetDataStore("Charred_Datastore")

--functions
local function saveData(Player)
	local Values = {
		Player.XPstuff.Level.Value;
		Player.XPstuff.Exp.Value;
	}
	pcall(function()
		ValueDB:SetAsync(Player.UserId, Values)
	end)
end




local function PlayerAdded(Player)
	task.wait()
	--setup
	local data

	local s, e = pcall(function()
		data = ValueDB:GetAsync(Player.UserId)
	end)

	if not s then warn(e) end


	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "XPstuff"
	leaderstats.Parent = Player

	local Level = Instance.new("NumberValue",leaderstats)
	Level.Name = "Level"

	local Exp = Instance.new("NumberValue",leaderstats)
	Exp.Name = "Exp"

	local RequiredExp = Instance.new("NumberValue", Player)
	RequiredExp.Name = "RequiredExp"
	RequiredExp.Value  = Level.Value * 100

	if data and data[1] then
		Level.Value = data[1]
	else
		Level.Value = 1
	end

	if data and data[2] then
		Exp.Value = data[2]
	else
		Exp.Value = 0
	end


	--maincode
	Exp.Changed:Connect(function(Changed)
		if Exp.Value>= RequiredExp.Value then
			Exp.Value = 0
			Level.Value += 1
			RequiredExp.Value = Level.Value * 100



		end
	end)
end



local function PlayerRemoving(Player)
	saveData(Player)
end

for _, Player in ipairs(Players:GetPlayers()) do
	PlayerAdded(Player)
end

Players.PlayerAdded:Connect(PlayerAdded)
Players.PlayerRemoving:Connect(PlayerRemoving)

Still getting the exact same error.

then its really ur games problem.
use it on a new place and test it.

Try running a debug of this:

local ClassVals = {
   ["LocalScript"] = "CLIENT",
   ["Script"] = "SERVER"
}



task.wait()
local plr = game.Players.LocalPlayer
local found = false
for i = 0, 5, 1 do
   for _, v in next, plr:GetChildren() do
      if v.Name == "XPStuff" then
         found = true
      end
   end
end

local str = ""
for i,v in pairs(plr:GetChildren()) do
   str = " " .. v.Name .. ","
end

if found == false then
   print("Not found, Instances found: {" .. str .. "} -- " .. ClassVals[script.ClassName])
else
   print("FOUND, Instances: {" .. str .. "} -- " .. ClassVals[script.ClassName])
end

If it wasn’t found; chance it is the replications.
I’ve set this debug up to check 5 times