Button telling me I'm not whitelisted.. when I am and it knows

Here’s the piece of the code in question (local script):

button.MouseButton1Click:Connect(function()
	if cooldown == false then
		cooldown = true

		if button.Parent.Name == "RC" and button:FindFirstChildOfClass("StringValue") then
			for _, child in pairs(button:GetChildren()) do
				if child:IsA("StringValue") then
					if player.UserId == child.Value then
						morphRemoteEvent:FireServer(button.Name, nil, "character")
						load(button.Name)
						chosenmorph = button.Name
						break
					else
						print("sorry you are not whitelisted")
						print(player.UserId)
						print(child.Value)
						continue
					end
				end
            end
        end
    end
end)

Essentially, it checks to see if there are any stringvalues parented to the button, and then tries to match the player’s userid with their values. If it finds a match, it does a thing. If there is no match, it prints some stuff. However, it isn’t working whenever I set it to my UserId.

image

As you can see, the bottom two print statements are identical so it should be working. But it isn’t. And I don’t know why. Any help with this subject would be much appreciated. I’m genuinely stumped lol

you are comparing a number to a string, do tonumber(child.Value) or tostring(player.UserId) for either and it will work

1 Like