Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Give cash to the player by chat command? [Solved]

Asked by 7 years ago
Edited 7 years ago

SOLVED BY MYSELF

01names = {"zZGalaxySolarManZz"}
02 
03game.Players.PlayerAdded:connect(function(Player)
04        for i, v in pairs(names) do
05          if v == Player.Name then
06            Player.Chatted:connect(function(chatmsg)
07                local amount, user = chatmsg:match('give/(%d%d?%d?%d?)%s+([%w_]+)')
08                if amount ~= nil and user ~= nil then
09                  for _,a in pairs(game.Players:GetChildren()) do
10                    local Find = a.Name
11                    local player = string.match(Find, user)
12                    if player then
13                      local Get = game.Players:FindFirstChild(player)
14                      Get.PlayerData.Rubies.Value = Get.PlayerData.Rubies.Value + (amount)
15                    end
View all 21 lines...
0
Well. I'm not going to script it for you. You will have to extract the number and player variable from the chatmsg. http://wiki.roblox.com/index.php?title=Global_namespace/String_manipulation The pattern "%S+" is useful. cabbler 1942 — 7y
0
Also, you're missing an end. :P TheeDeathCaster 2368 — 7y
0
Solved :) zZGalaxySolarManZz 49 — 7y

Answer this question