So i have a folder under the player named “stats” and i have a string value under that folder named “server1Size” all places where i try to get it, it says “server1Size is not a valid memeber of folder” but it is and i also have a string value under stats named “server1power” and there’s no issues with this one.
The problem is not that i don’t wait for it to exist because when i use “WaitForChild” it says “Infinite possible yield on WaitForChild(“server1Size”)” can anyone explain?
Here’s my code
-- Server Script
-- Folders --
local stats = Instance.new("Folder", player)
stats.Name = "stats"
-- Values --
local money = Instance.new("StringValue", stats)
money.Name = "money"
money.Value = "0"
local wood = Instance.new("StringValue", stats)
wood.Name = "wood"
wood.Value = "0"
local server1 = Instance.new("BoolValue", stats)
server1.Name = "server1"
server1.Value = true
local server1Size = Instance.new("StringValue", stats)
server1Size.Name = "server1Size"
server1Size.Value = "0"
-- This is the one with the problem
local server1Power = Instance.new("StringValue", stats)
server1Power.Name = "server1Power"
server1Power.Value = "0"
local server1SizePrice = Instance.new("StringValue", stats)
server1Size.Name = "server1SizePrice"
server1Size.Value = "100"
local server1PowerPrice = Instance.new("StringValue", stats)
server1Power.Name = "server1PowerPrice"
server1Power.Value = "100"
-- Other script where there's error's
game.ReplicatedStorage.Remote.Server.GetServerInfo.OnServerInvoke = function(player)
local plr = game.Players:FindFirstChild(player.Name)
local stats = plr.stats
stats:WaitForChild("server1Size") -- Error: Infinite possible yield
local data = {}
data[1] = stats.server1.Value -- No errors
data[2] = stats.server1Size.Value --- Error: server1Size not a valid member of folder
return data
end
your problem is that where you are putting all your values into the stat folder under server1SizePrice u put server1Size instead of server1SizePrice
local server1SizePrice = Instance.new("StringValue", stats)
server1Size.Name = "server1SizePrice" -- replace the server1Size to server1SizePrice
server1Size.Value = "100" -- replace the server1Size to server1SizePrice
no but when i used the script and if you play test and then check the folder there is no server1Size because you are using server1Size in the the server1SizePrice part so you do have server1Size just you renamed it to server1SizePrice just try it thats why you cant find it using WaitForChild since there is no server1Size