I’m currently attempting to make a money give system in which when the player enters the username and amount of money they wish to send, it will drop a money bag for that player to pick up and receive the given money. This system works fine except for one primary issue. If the player enters a negative number such as “-10” or “-100” it will give them money from nowhere. I attempted to make the code have a
if value < 0 then
But it will not work. Any help?
script.Parent.MouseButton1Click:Connect(function()
local money = script.Parent.Parent.amount.Value
local GUI = script.Parent.Parent.Parent.Frame.TextBox.Text
local send = script.Parent.Parent.username.Value
if game.Players.LocalPlayer.leaderstats.Lyr.Value >= script.Parent.Parent.amount.Value then
if game.Players:FindFirstChild(send) then
game.ReplicatedStorage.Money:FireServer(send, money)
script.Parent.Parent.userna.Text = ''
script.Parent.Parent.TextBox.Text = ''
end
end
end)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Leaderstats = Player:WaitForChild("leaderstats")
local Lyr = Leaderstats:WaitForChild("Lyr")
local Replicated = game:GetService("ReplicatedStorage")
local Money = Replicated:WaitForChild("Money")
local Button = script.Parent
local Frame = script.Parent.Parent
Button.MouseButton1Click:Connect(function()
local Money = Frame.amount.Value
local SendTo = Frame.username.Value
if Lyr.Value >= Frame.amount.Value then
local Receiver = Players:FindFirstChild(SendTo)
if Receiver then
Money:FireServer(Receiver, Money)
Frame.userna.Text = ''
Frame.TextBox.Text = ''
end
end
end)