model = script.Parent.Parent.Model
price = 100
blarg = script.Parent.Parent.Name
copy = model:Clone()
wait(1)
model:Destroy()
Owner = script.Parent.Parent.Parent.Owner
local safety = 0
function onTouched(hit)
if safety == 0 then
safety = 1
check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
if hit.Parent.Name == Owner.Value then
--------------------------------- Here's the problem----------
guy = hit.Parent.Name
local cash = Workspace.Cash.guy
----------------------------------------------------------
if cash.Value > (price-1) then
cash.Value = cash.Value-price
copy.Parent = script.Parent.Parent
copy:MakeJoints()
script.Parent.Parent.Humanoid:Destroy()
script.Parent:Destroy()
elseif cash.Value < (price-1) then
script.Parent.Parent.Name = ("You still need $"..(price-cash.Value).." to purchase this.")
wait(2)
script.Parent.Parent.Name = blarg
end
end
end
safety = 0
end
end
script.Parent.Touched:connect(onTouched)
The problem here is that when a player joins the game I create a new NumberValue in a model called Cash in Workspace. The NumberValue's name is their name. How would I get it to check the NumberValue with their name when it checks how much money they have? I selected the area in the script where I tried to make it work.

2 comments
If 'guy' is a value, you would do local cash = Workspace.Cash.guy.Value
Any errors? Also, on line 19 try 'if cash.Value >= price then' and line 25 try 'elseif cash.Value <= price then'.