I'm adding buyable characters, but this script doesn't work and I don't know what's wrong, keep in mind it is NOT a local script

-- Note: 1 = true, 0 = false

local t = script.Parent.Parent.Label
local p = t.Parent.Parent.Parent.Parent.Parent.Parent
local b = script.Parent
local st = p:WaitForChild("AnimsChar").OwnsIntellect
local coins = p:WaitForChild("leaderstats").Coins
local cost = 250

b.MouseButton1Click:connect(function()
	if coins.Value >= cost then
	if st.Value == 0 then
		st.Value = 1
		coins.Value = coins.Value - cost
		print('k')
	end
	end
end)