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

Why doesn't this work?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
admin = { "FergotCheese","StargateOne" }

function isAdmin(plrname)

    for _,v in pairs(admin) do
        if plrname == v then
            return true
        end

    end

    return true

end



game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Aim" then

                x = game.Lighting.Aim:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Aim"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end

     game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Skylands" then

                x = game.Lighting.Skylands:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Skylands"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Sniper" then

                x = game.Lighting.Sniper:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Sniper"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/City" then

                x = game.Lighting.City:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran City"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Aim" then

                x = game.Lighting.Aim:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Aim"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Climb" then

                x = game.Lighting.Aim:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Climb"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Colors" then

                x = game.Lighting.Colors:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Colors"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/FreezeTag" then

                x = game.Lighting.FreezeTag:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran FreezeTag"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Obby" then

                x = game.Lighting.Obby:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Obby"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/Obby2" then

                x = game.Lighting.Obby2:Clone()
            M = Instance.new("Hint")

                M.Parent = game.Workspace

                M.Text = "Ran Obby2"

                wait(0.1)

                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end
game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then

        nP.Chatted:connect(function(msg)
            if msg == "Run/SFT" then
                x = game.Lighting.SFT:Clone()
            M = Instance.new("Hint")
                M.Parent = game.Workspace

                M.Text = "Ran SFT"
                wait(0.1)
                x.Parent = game.Workspace

                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds

            end

game.Players.PlayerAdded:connect(function(nP)

    if isAdmin(nP.Name) then
        nP.Chatted:connect(function(msg)
            if msg == "Run/SimonSays" then
                x = game.Lighting.SimonSays:Clone()
            M = Instance.new("Hint")
                M.Parent = game.Workspace
                M.Text = "Ran SimonSays"
                wait(0.1)
                x.Parent = game.Workspace
                Game:GetService("Debris"):AddItem(M, 3) -- add M to debris, and remove after 3 seconds 

0
What debugging have you done yourself? What errors are there? BlueTaslem 18071 — 10y

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

I don't want to read all that super carefully, unless you put in any errors or other debugging you've done, but here are some things I noticed:

Make sure 'game' is lower case.

In your isAdmin function, you are returning true no matter what happens. Is this what you want?

Why do you have multiple PlayerAdded and Chatted event handlers?

Make sure you add all correct ends.

It would be more efficient to have you maps in ServerStorage, not Lighting.

I also have a holo script in my models, you can look over its code and try to learn from it if you like.

Ad

Answer this question