I spent a few days trying to figure out how to fix the bug. In the end, I did it, thanks to those who tried to help.
I made an admin script and every command works only once and then stops working, I am using a blind command, then unblind and when I try to blind myself again it won’t work. But as you can see, the output is working normally. How to fix this?
(Also, I’m a beginner in scripting so expect stupid mistakes)
This script works through RemoteEvent
LocalScript
script.Parent.FocusLost:Connect(function()
local remoteEvent = script.Parent:WaitForChild("GlobalCMD")
local txt = script.Parent.Text
for i,v in pairs(game.Players:GetPlayers()) do
if txt == "blind "..v.Name then
print("Sent data")
remoteEvent:FireServer(txt, v, "blind")
script.Parent.Parent.OpenCMD.Disabled = false
script.Parent.Text = ""
script.Parent.Visible = false
elseif
txt == "unblind "..v.Name then
print("Sent data")
remoteEvent:FireServer(txt, v, "unblind")
script.Parent.Parent.OpenCMD.Disabled = false
script.Parent.Text = ""
script.Parent.Visible = false
elseif
txt == "cmds" then
script.Parent.Parent.CMDList.Visible = true
script.Parent.Parent.OpenCMD.Disabled = false
script.Parent.Text = ""
script.Parent.Visible = false
else
script.Parent.Parent.OpenCMD.Disabled = false
script.Parent.Text = ""
script.Parent.Visible = false
end
end
end)
Script
local remoteEvent = script.Parent:WaitForChild("GlobalCMD")
remoteEvent.OnServerEvent:Connect(function(plr, txt, name, cmd)
-- Blind command
if cmd == "blind" then
name.PlayerGui.JCMD.ScriptsForPlayers.Blind.Disabled = false
print("Blind command sent")
print(name.Name)
print("Script disabled status: "..tostring(name.PlayerGui.JCMD.ScriptsForPlayers.Blind.Disabled))
-- Unblind command
elseif
cmd == "unblind" then
name.PlayerGui.JCMD.ScriptsForPlayers.UnBlind.Disabled = false
print("Unblind command sent")
print(name.Name)
print("Script disabled status: "..tostring(name.PlayerGui.JCMD.ScriptsForPlayers.Blind.Disabled))
end
end)
Output:
I ran a blind command, then an unblind command, they worked. But then I ran a blind and unblind again and they didn’t work. But the output worked normally.
Also, there is an explorer, if it will help somehow.