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

"object is not valid member of TextButton" error?

script.Parent.MouseButton1Down:connect(function()
	script.Parent.Visible = false
	while wait() do
		local players = script.Parent.Parent.PlayerList
		players.LocalPlayer.object.Value = game.Players.LocalPlayer
		local tabl = players:GetChildren()
		local thing = {}
		for i, v in pairs(tabl) do
			local name = v.Name
			local check = string.sub(name,1,6)
			if check == "Player" then
				table.insert(thing, v)
			end
		end
		local playerz = game.Players:GetChildren()
		for i, v in pairs(playerz) do
			for a, b in pairs(thing) do
				b.object = v
			end
		end
	end
end)

there IS a child named object in b so idk why its not working, please help! line 18 https://gyazo.com/5b901ba2654c27e6a32d1b1e0123c66d

1 answer

v is already defined in the for i, v in pairs(playerz) statement meaning that

b.object = v would do nothing

and the variable should be infront but its already defined earlier

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