You can write your topic however you want, but you need to answer these questions:
-
I need help with getting rid of this error
-
Error
-
I’ve tried changing stuff but i can get it
-- game money
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new("Folder", player)
stats.Name = "Stats"
local moneyvalue = Instance.new("NumberValue")
moneyvalue.Parent = player:WaitForChild("Stats")
moneyvalue.Name = "Money"
while true do
moneyvalue.Value = moneyvalue.Value + 60
wait(1)
end
end)
local moneyaction = {}
local prefix = "/"
-- command
moneyaction.drop = function(sender, args)
for i, playerName in pairs(args) do
local amount = args[1]
if sender then
if amount then
print(amount)
print(sender.Stats.Money.Value)
if amount > sender.Stats.Money.Value then
elseif amount > sender.Stats.Money.Value and amount > 0 then
local cashvalue = game.ReplicatedStorage.Cash.CashValue
cashvalue.Value = amount
local cashgui = game.ReplicatedStorage.Cash.Moneygui.Value
cashgui.Text = amount
local rsclone = game.ReplicatedStorage.Cash:Clone()
rsclone.CFrame = sender.character.HumanoidRootPart.CFrame
rsclone.Parent = workspace
end
end
end
end
end
-- chat functions
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
message = string.lower(message)
local ss = message:split(" ")
local slashCommand = ss[1]
local cmd = slashCommand:split(prefix)
local cmdName = cmd[2]
if moneyaction[cmdName] then
local args = { }
for i = 2, #ss, 1 do
table.insert(args, ss[i])
end
moneyaction[cmdName](player,args)
end
end)
end)