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

Not a valid member of textbutton?

Whenever I run this script the error "banned is not a valid member of textbutton," this script it not meant to be FE and when I test it on a non-FE environment this error come up. Here is the code

local player = game.Players
local button = script.Parent
local ew  = game.Players.LocalPlayer
local banned = script.Parent.banned.Value

script.Parent.MouseButton1Click:connect(function()
	
	if game.Players.LocalPlayer:IsInGroup(123980) then
				script.Parent.Text = "Welcome"
	else
		if game.Players.LocalPlayer.UserId == banned then
			script.Parent.Text = "You  are banned!" else
			
				script.Parent.Text = "Banned until you join the group!"
		wait(3)
		
		
		
		end
		
		
	end
end)

I put banned as a number value inside textbutton. Does anyone know the answer? This code is also inside a localscript. The group ID is also fake for my testing purposes. Also if I was to make this FE how would I do it?

1 answer

✓ Accepted answer

Chances are, the script is running before the number value loads in. You can fix it by using WaitForChild()

local banned = script.Parent:WaitForChild('banned').Value

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