Attempting to index number with "Value"?

Thats great, I am glad it works now!

When you say this line there, you’re saying rc.Value which only works with int or number values!
Try using this instead:

if rc <= rc then

Now, if rc is an object then I suggest you rename it because the two of the variables are conflicting!

Not true, .Value is basically trying to access the property Value so it works for tables containg the property Value or anything with __index

Sorry about my wording, what I meant to say it’s only a property of the different objects which properties are just the .Value property. I’m not talking about tables or anything, just objects containing said property.

This code would fix it,

local rc = 500

local debounce = true
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player.leaderstats.Cash.Value >= rc then
			if debounce then
				debounce = false
				script.Parent.Transparency = 0.5
				script.Parent.CanCollide = false
				if player.leaderstats.Cash.Value <= rc then
					script.Parent.Transparency = 0.3
					script.Parent.CanCollide = true
				end
			end
		end
	end
end)

Basically, “if rc.Value <= rc then” does not work, as rc is not an Instance that you would typically see in the explorer, it’s a number.

However, if it would be:

local rc = workspace.SampleValue
(example)

It would work. But like I said, it’s a number, not a value instance.

For this line:

if rc.Value <= rc then

You have to just say:

if rc <= rc then

This is because you assigned a number to this variable rc, and it isn’t a ...Value object in the game explorer, therefore .Value is not a valid property of a number, hence:

307cf816e375aee57c4d2866a2b8b21f

Why is this post still getting attention, the problem was already solved lol.

You did not mark a solved answer; we are assuming it is not solved.

Maybe mark my post above, as the solution? (the most recent) :man_shrugging:

I just realized, my bad. I thought I had.

No worries, keep up the good development. :+1: