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

What does W001:Unknown global 'character' and W001:Unknown global 'player' mean?

So I'm seeing this blue underline appear under character and player in this code:

		if **character**.Head:FindFirstChild("BillboardGui") then
			local clonedgui = billboardgui:Clone()
			clonedgui.TextLabel.Text = "Guest"
			clonedgui.TextLabel.TextColor3 = Color3.fromRGB(75,171,144)
			clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		end

		if **player**:IsInGroup(5330388) then
			local clonedgui = billboardgui:Clone()
			clonedgui.TextLabel.Text = "Trainee"
			clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,230,255)
			clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		end

I've put asterisks around the character and player where the blue underline appears. If anyone knows how to solve this, please answer! It'd mean a lot for myself and the game I'm working on!

2 answers

✓ Accepted answer

lets do some steps: 1-- have you checked if you are putting this code in a function?

2-- did you put "local" infront when you were creating the "character" and "player" variables? (will not let functions that do not have "character"/"player" identified)

3-- did you create/identify the variables "character" and "player"?

W001:Unknown global means that you are trying to use a variable a reference has not been created for.

An example that would produce W001: Unknown global would be:

local a = 10

function sum()
	return a + b -- we have not declared a value for b, yet try to use it
end

To fix this, you need to make define player and character somewhere in your script.

1 comment

0

Thanks so much! Now I know for future reference. :)

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