i was messing around with my admin commands sscript because it didnt work. now i actually got an output, it still does nothing but heres the script:
--//Admin Commands Script --//Variables\\-- local DataStore = game:GetService("DataStoreService") local BanList = DataStore:GetDataStore("BanList") local Admins = {"RedLecko434", "RedLoL7u7", "franchun04"} --//People who you want as admins --//Events\\-- game.Players.PlayerAdded:connect(function(Player) local Folder = Instance.new("Folder", Player) Folder.Name = "PlayerValues" local BanCheck = Instance.new("BoolValue", Folder) BanCheck.Name = "IsBanned" BanCheck.Value = BanList:GetAsync(Player.userId) or false --//False is default if no save for the player --//Checks if the player is banned or not if Player.PlayerValues.IsBanned.Value == true then Player:Kick("You're Banned") --//Reason for kick end Player.Chatted:connect(function(message) for i, AdminName in ipairs(Admins) do if Player.Name == AdminName then --//Commands\\-- --//Kill Command if message:sub(1, 6) == "/kill " then game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer() local TargetPlayer = game.Players:FindFirstChild(message:sub(7)) if TargetPlayer then local Character = TargetPlayer.Character if Character then Character.Humanoid.Health = 0 end end end --//Heal Command if message:sub(1, 6) == "/heal " then game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer() local TargetPlayer = game.Players:FindFirstChild(message:sub(7)) if TargetPlayer then local Character = TargetPlayer.Character if Character then Character.Humanoid.Health = Character.Humanoid.MaxHealth end end end --//Kick Command if message:sub(1, 6) == "/kick " then game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer() local TargetPlayer = game.Players:FindFirstChild(message:sub(7)) if TargetPlayer then TargetPlayer:Kick("Kicked by " .. Player.Name) --//Kick message/reason end end --//Ban Command if message:sub(1, 5) == "/ban " then game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer() local TargetPlayer = game.Players:FindFirstChild(message:sub(6)) if TargetPlayer then local BanCheck = TargetPlayer.PlayerValues.IsBanned if BanCheck then BanCheck.Value = true BanList:SetAsync(TargetPlayer.userId, true) end TargetPlayer:Kick("You've been banned by " .. Player.Name) --//Reason || Message end end --//Unban Command if message:sub(1, 7) == "/unban " then --//USES ID NOT NAME game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer() local UserId = tonumber(message:sub(8)) if UserId then BanList:SetAsync(UserId, false) end end if message:sub(1, 7) == "/StrGl " then game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer() local TargetPlayer = game.Players:FindFirstChild(message:sub(7)) if TargetPlayer then game.ServerStorage.sg:GetChildren(TargetPlayer) end end break end end end) end)
also the output is:
Infinite yeld possible on "ReplicatedStorage:WaitForChild("RemoteEvent")" Stack Begin Script "Workspace.comandos adnin", Line (here it says 81 but i discovered that it is just from where command is from (Ex. if kill is on line 21 and heal on 81, if i execute kill it will show 21, and if i execute heal it will show 81))
Gl as always.
You need to create a RemoteEvent in ReplicatedStorage or put this in your code:
local RemoteEvent = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
When using :WaitForChild() the error "Infinite yield possible on..." means it could not find the child in the specified directory. Make sure its there and if it is, make sure its spelled correctly. In addition to this the lines that are using the RemoteEvent are firing the server, but you can't use FireServer() to the server. If you wanted to fire a remotevent for the client(player) then you should use FireClient(addplayernamehere). If you wanted to fire an event in another server script then you should use a BindableFunction.