I am trying to create a custom admin bar with working admin commands. Right now, I'm trying to make a damage command. The problem is in the server script, line 10.
I'll add the server script and local script (if needed), may anyone tell me what's wrong with my code?
--LOCAL SCRIPT--
wait()
local rf = game:FindFirstChild("ReplicatedStorage").RemoteEvents.apcmd
local ok = script.Parent.submitcmd
local bar = script.Parent.cmdbar
ok.MouseButton1Click:Connect(function()
rf:FireServer(bar.Text)
end)
--SERVER SCRIPT--
local plrs = game:GetService("Players")
local rf = game.ReplicatedStorage.RemoteEvents.apcmd
rf.OnServerEvent:Connect(function(player,cmd)
if cmd:sub(1,7) == "damage " then
local plr = plrs:FindFirstChild(cmd:sub(8))
game.Workspace[plr.Name].Humanoid.Health = game.Workspace[plr.Name].Humanoid.Health - cmd:sub(10)
end
end)

1 comment
which line of script did you get the error?