So I'm trying to check if the player has enough to bet before it takes their coins. The check keeps sending an error. I have done this same check on several other things but this one errors. Can anyone help?
local Player = game.Players.LocalPlayer
local Sample = script.Sample
local Bet = script.Parent.Bet.Input.Text
local Accept = script.Parent.Accept
local Players = script.Parent.Players.ScrollingFrame
local Timer = script.Parent.Timer
local Total = script.Parent.Total
local Decrement = game.ReplicatedStorage.Events.Decrement
Accept.MouseButton1Click:Connect(function()
if Bet.Text ~= "" then
if Player.Cash.Value >= tonumber(Bet.Text) then -- This is sending the error.
Decrement:FireServer("Cash",tonumber(Bet.Text))
local Clone = Sample:Clone()
Clone.Parent = Players
Clone.Username.Text = Player.Name
Clone.Bet.Text = "$" .. Bet.Text
end
end
end)

2 comments
What kind of value is "cash" on line 13?
It's an Int Value