Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Script doesn't execute in-game?

Asked by 9 years ago

I get no errors on the Dev. Console, I've even put prints before the very first variable, and not even that prints onto the console.

local Admins = script.Admins
local Crash = script.CrashScript
local Players = game:GetService("Players")

function AdminCheck(checkAdmin)

    local Check = Admins:GetChildren()

    for i = 1, #Check do

        if Admin[i].Name == checkAdmin then return true

        else return false   
        end
    end
end

Players.PlayerAdded:connect(function(Client)

    if Admins:FindFirstChild(Client.Name) == true then

        Client.Chatted:connect(function(Chat)

            if string.sub(Chat, 1, 9):lower() == ":crashban" then

                local Noob = string.sub(Chat, 11):lower()
                print ("Noob: ", Noob)

                for i, v in pairs(Players:GetChildren()) do

                    if string.sub(v.Name, 1, string.len(Noob)):lower() == string.sub(Noob, 1):lower()  and not AdminCheck(v.Name, false) then

                        local CrashBan = Crash:Clone()
                              CrashBan.Parent = v.Backpack
                              CrashBan.Disabled = false

                    else print ("[Crash-Ban] Erorr: " .. Noob .. " is an Admin, unable to continue.")
                    end
                end
            else
            end
        end)
    else
    end
end)
0
Try changing line 20 to `if Admins:FindFirstChild(Client.Name) then` 2eggnog 981 — 9y
0
No difference. However, the part that baffles me is if I put a print at line 1, it will never post on the Dev Console, it's as if the script isn't executing at all. Sectarian 5 — 9y

1 answer

Log in to vote
1
Answered by
jakedies 315 Trusted Moderation Voter Administrator Community Moderator
9 years ago

It might be possible that your script is disabled. What type of script is this? And where is it located?

Also your admincheck function returns false after the first iteration, so if the player you check is not the first object's name in script.Admins, then it will be false no matter what. Put the return false after the loop as well as fixing line 20.

0
It's a Global Script located in ServerScriptStorage. It's not disabled. And, alright, I'll do that. Thanks for the suggestions, however, you seem to be ignoring the main issue guys. It never executes. Lua reads through a script the executes from the bottom up. Before any functions, variables, etc. I've put a simple print, and not even that works. Sectarian 5 — 9y
1
ServerScriptService or ServerStorage? You mixed them together. If it's located in the former and adding a print to line 1 doesn't output anything in the server console, then can you take a SS of your studio window while showing the script object in SSS (selected so we can also see the properties). jakedies 315 — 9y
0
Not sure what you said, but it works now. I rewrote it and it worked for whatever reason. And scripts do run from SSS. I'll give you guys a check for trying though. I appreciate it. Sectarian 5 — 9y
0
I was just confused as you said ServerScriptStorage, whether you were implyingServerStorage or ServerScriptService. Alright glad to see you got it fixed. jakedies 315 — 9y
Ad

Answer this question