Hey, we recently published a new tutorial for creating Chat Commands for your game.
If you have any questions, feedback, issues etc, then please let us know.
https://docs.coregames.com/tutorials/chat_commands_tutorial/
Hey, we recently published a new tutorial for creating Chat Commands for your game.
If you have any questions, feedback, issues etc, then please let us know.
https://docs.coregames.com/tutorials/chat_commands_tutorial/
Hello
I tested it but I couldn’t get creator, I just managed to get admin.
after that I wanted to add the sript "Reset Storage"
it doesn’t work and makes me a mistake
" Error running Lua task: [EF283288C6ADDB36] ResetStorage:1: attempt to index a nil value "
local COMMANDPARSER = script:GetCustomProperty("Commandparser")
-- /resetstorage player
-- /resetstorage all
CommandParser.AddCommand("resetstorage", function(sender, params, status)
if CommandParser.HasPermission(sender, CommandParser.permissions.ADMIN) then
local who = CommandParser.ParamIsValid(params[2])
if who ~= nil then
if who == "all" then
for k, player in ipairs(Game.GetPlayers()) do
if player ~= sender then
Storage.SetPlayerData(player, {})
end
end
status.success = true
status.senderMessage = "All players reset."
else
who = CommandParser.GetPlayer(params[2])
if who ~= nil then
Storage.SetPlayerData(who, {})
status.success = true
status.senderMessage = "Player reset."
status.receiverMessage = "You have been reset."
status.receiverPlayer = who
end
end
else
status.senderMessage = CommandParser.error.INVALID_PLAYER
end
else
status.senderMessage = CommandParser.error.NO_PERMISSION
end
end)
If I remove line 1 in the reset storage script I have this error
Error running Lua task: [EF283288C6ADDB36] ResetStorage:4: attempt to index a nil value (global 'CommandParser')
local COMMANDPARSER = script:GetCustomProperty("Commandparser")
That line is wrong. It's CommandParser
, and you need to require the script.
ok I changed my error and I have this error :
Error running Lua task: [35EF6FF390718DCA] rezetSorage:4: attempt to call a nil value (field 'AddCommand')
player joined: Diester
Post your code please.
local COMMAND_PARSER = script:GetCustomProperty("CommandParser")
-- /resetstorage player
-- /resetstorage all
CommandParser.AddCommand("resetstorage", function(sender, params, status)
if CommandParser.HasPermission(sender, CommandParser.permissions.ADMIN) then
local who = CommandParser.ParamIsValid(params[2])
if who ~= nil then
if who == "all" then
for k, player in ipairs(Game.GetPlayers()) do
if player ~= sender then
Storage.SetPlayerData(player, {})
end
end
status.success = true
status.senderMessage = "All players reset."
else
who = CommandParser.GetPlayer(params[2])
if who ~= nil then
Storage.SetPlayerData(who, {})
status.success = true
status.senderMessage = "Player reset."
status.receiverMessage = "You have been reset."
status.receiverPlayer = who
end
end
else
status.senderMessage = CommandParser.error.INVALID_PLAYER
end
else
status.senderMessage = CommandParser.error.NO_PERMISSION
end
I corrected another mistake on my part -> rezetstorage for resetstorage
and always
Error running Lua task: [35EF6FF390718DCA] resetstorage:4: attempt to index a nil value (global 'CommandParser')
You need to make sure the variable for the property is correct. You also are not requiring the script. It's an API.
This line is wrong:
local COMMAND_PARSER = script:GetCustomProperty("CommandParser")
It needs to be:
local CommandParser = require(script:GetCustomProperty("CommandParser"))
yes it works without error thx but I don’t understand too much because this line is the editor who gives it to me when I add the sript commandperser in my sript resetstorage...
this said impossible to give me promotion in local
If you are following the tutorial, they go by what that says. It doesn't tell you to copy the code from the editor
yes I have read well and this is notifying nowhere but without this line of code I have an error anyway so I thought I had to copy this line.
without this line I have the error
Error running Lua task: [35EF6FF390718DCA] resetstorage:3: attempt to index a nil value (global 'CommandParser')
in the sript taken as is on the tuto of the site and which is :
-- /resetstorage player
-- /resetstorage all
CommandParser.AddCommand("resetstorage", function(sender, params, status)
if CommandParser.HasPermission(sender, CommandParser.permissions.ADMIN) then
local who = CommandParser.ParamIsValid(params[2])
if who ~= nil then
if who == "all" then
for k, player in ipairs(Game.GetPlayers()) do
if player ~= sender then
Storage.SetPlayerData(player, {})
end
end
status.success = true
status.senderMessage = "All players reset."
else
who = CommandParser.GetPlayer(params[2])
if who ~= nil then
Storage.SetPlayerData(who, {})
status.success = true
status.senderMessage = "Player reset."
status.receiverMessage = "You have been reset."
status.receiverPlayer = who
end
end
else
status.senderMessage = CommandParser.error.INVALID_PLAYER
end
else
status.senderMessage = CommandParser.error.NO_PERMISSION
end
end)
the important thing is that with your line I put online 1 I no longer have the error
The require information is in the tutorial.
Yes it is this page that I use as a reference, I may not be smart enough to understand it.
Sorry to waste your time, the script works but I can’t reset my score on my current game test.
thank you for your help and again sorry for disturbing