placedBet is nil; gauging other replies you need to add another error to check for
if placedBet == nil then
outCome.Text = "Invalid input, not a number!"
return
end
if not money or money.Value < placedBet then
outCome.Text = "Not enough money to place the bet!"
print("Not enough money!")
return
end
local Catrino = playerGui.MainScreen.FrameCasino
local outCome = Catrino.WonORlose
local button = Catrino.PlaceBet
local slots = {Catrino.SlotPlace1, Catrino.SlotPlace2, Catrino.SlotPlace3}
local placedBet = tonumber(Catrino.PlrInput.Text)
and i have:
print("Input Text:", Catrino.PlrInput.Text)
if not placedBet or placedBet <= 0 then
outCome.Text = "Invalid bet amount!"
print("Invalid bet amount!")
return
end
I think this proves that player’s text fields are not replicated and must be sent through a remote event. You will have to split this input field into a Local script
Create a remote event in ReplicatedStorage, lets name it PlaceBet
Create a local script as a child of your bet text input.
local place_bet_remote = game:GetService("ReplicatedStorage").PlaceBet
script.Parent.FocusLost:Connect(function(enter_pressed)
if enter_pressed then
place_bet_remote:FireServer(script.Parent.Text)
end
end)
For your server script you now have to run your function as part of the remote event
local place_bet_remote = game:GetService("ReplicatedStorage").PlaceBet
place_bet_remote.OnClientEvent:Connect(function(player, bet_text)
local Catrino = player.PlayerGui.MainScreen.FrameCasino
local placedBet = tonumber(bet_text)
-- etc..
end)