Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Roblox Studio is not recognizing my code (W001 unknown global)?

I am trying to code stats into my game and it keeps giving me an error on nil value every time I attempt to run the game I believe the cause of this to be the W001 unknown global problem on my WaitForChild.

local plr = game:GetService("Players").LocalPlayer

function update()
	local Stats = game:GetService("ReplicatedStorage")WaitForChild("Stats")WaitForChild(plr.Name)
	for i,v in pairs(script.Parent.Stats:GetChildren()) do
		v.Text = Stats:FindFirstChild(v.Name).Value
		end
	end
while wait(1) do
	update()
end

is the code

1 answer

✓ Accepted answer

It's because you are forgetting to put colons between the parentheses of the last call and WaitForChild().

game:GetService("ReplicatedStorage"):WaitForChild("Stats")

1 comment

0

thankyou

This discussion is preserved as it was. New answers, comments, and votes are closed.