Hello developers. I have an admin command script that uses loadstring so I can change certain things on the fly while I am playing. The problem is whenever I try to set a value it says attempt to call a nil value
but I never called any function. Here’s my script:
local Commands = {
[";s"] = {Type = 1, Function = function(Message)
local s, e = pcall(function()
loadstring(Message)()
end)
if not s then warn(e) end
end};
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Player.Name == "DatabaseReplace" then
Message = string.split(Message, " ")
local Command = Message[1]
local Parameter = Message[2]
if Commands[Command] then
if Commands[Command].Type == 1 then
local s, e = pcall(function() Commands[Command].Function(Parameter) end)
if not s then warn(e) end
end
end
end
end)
end)
If I do something like ;s print'hi'
, it works fine, but I do something like ;s workspace.DatabaseReplace.Humanoid.Health = 0
I get the error. Can anyone help? Thanks!