Why won't MouseButton1Click work on my TextButton?

I think you need to use v.Level.Value

Also there is one end missing if im right.

1 Like

You’re trying to reference the Part that contains the child “level”.

1 Like

the same LocalScript

local player = game.Players.LocalPlayer
local playerLevel = player.leaderstats:WaitForChild("Level")
local playerGui = player:WaitForChild("PlayerGui")
local shop = playerGui:WaitForChild("Shop")
local primaryShopButton = shop:WaitForChild("PrimaryShopButton")
local frameLevel = script.Parent:WaitForChild("FrameLevel")

	primaryShopButton.MouseButton1Down:Connect(function()
		print("Click")
		wait(.1)
		for _, v in pairs(script.Parent:GetDescendants()) do
			if v:FindFirstChild("Level") then
				
			if v.Value >= playerLevel.Value then
				frameLevel.Visible = false
			else
				frameLevel.Visible = true
			end
		end
	end
end)

Screenshot (174)

yes I think
but its not giving any error for now

Oh. Yeah nevermind. The lines are just not clean. There is no end missing, sorry.

1 Like

I change it to v.Level.Value
and it’s sending a new error at Line 14

error: attempt to compare number and string

One of your Values is a string then. Either change the string one to a number or try to handle it with tonumber()

1 Like

awesome its work now!
thanks you very much :heart:

1 Like

Thank you all very much :sparkling_heart:

Would be appreciated if you give the solution for this topic.

1 Like

yes I give it
I give the:
local player = game.Players.LocalPlayer
am I right is that I must give?

Whoever’s comment helped solve the problem click the “solution” button on it.

already did…