I wrote a pay command, and it seems to work fine, except for this error
11:02:48.400 - ServerScriptService.PayCommand:10: attempt to compare string with number
How do I turn the string to an integer?
--Gitrog's Pay Command --Retrieves a money tool from the specified location, and when that tool is used it gives that much money. --Script requires a money leaderstat local location = game.ServerStorage.SpawnerStorage --Where you are storing MoneyTool function onChatted(message, player) if message:sub(1,5) == "/pay " then local money = message:sub(6) if player.leaderstats.Money.Value >= money then location.MoneyTool:Clone().Parent = game.Players[player.Name].Backpack local moneyTool = game.Players[player.Name].Backpack.MoneyTool moneyTool.Value.Value = money player.leaderstats.Money.Value = player.leaderstats.Money.Value - money else print(player.Name .. " does not have $" .. money) end end end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end)
Fixed it myself. For anyone who's having the same issue
local money = tonumber(message:sub(6))