Hello developers! Me and a friend are creating a tycoon to learn to script and have come across an issue in our script.
We are trying to make a purchase that goes off when you step on a plate in the tycoon. For some reason even when my cash is more than 50 it says “not enough money” even though it is enough. It always says “not enough money” even when it is over 50.
![]()
How can we resolve this? Our code:
baseplate = script.Parent
debounce = false
baseplate.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
print("hi")
if hum ~= nil and debounce == false then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.Team == "Purple Tycoon" then
if player.leaderstats.Cash.Value.Value >= 50 then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 50
local autodropper = workspace.Folder["F1 dropper 1"]:Clone()
autodropper.Parent = workspace.Objectscreated
autodropper:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-136.612, 501.442, -505.756)))
end
else
print("not enough money")
print(player.leaderstats.Cash.Value)
end
end
end)