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

help with finding cash value in player?

ok so im learning to make tycoon type things now and the only part i am stuck on is the buy buttons, how would i find if the person touching it has the cash or not?

um i dont know about this tags thing, i never formally learned Lua so i dont know what most of them mean..

1 answer

The following script will check to see if the player has cash above 300. If he does, then it will print "Success" in the output:

local RequiredCash = 300

script.Parent.Touched:connect(function(h)
	if h.Parent:FindFirstChild("Humanoid") then
		local p = game.Players:FindFirstChild(h.Parent.Name)
		if p.leaderstats.Cash.Value > RequiredCash then
			print("Success")
		end
	end
end)

1 comment

0

thanks

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