Ad
Log in to vote
-1

Chatted Event Help/Multiple Functions[EDIT]

Asked by 7 years ago

The script has been edited, still doesn't work. Please help me out!

admins = {"wattleman"}
group = {899203}
rankid = 50
keyword = {"gun"}

function isAdmin()
    for i,v in pairs(admins) do
        if Player.Name == (v) then
            return true
            elseif Player.Name ~= (v) then
            for i,v in pairs(group) do
                if Player:isInGroup(v) and Player:GetRankInGroup(v) >= 50 then
                    return true
                end
            end
        end
    end
end


game.Players.PlayerAdded:connect(function(Player)
    Player.Chatted:connect(function(Message)
        if Player(isAdmin(Player)) then
            for i,v in pairs(keyword) do
                if Message:lower() == (string.sub("gun") (1, 3)) then
                    trigger()
                    elseif Message:lower() == (string.sub("countdown") (1, 9)) then
                    local cdt = game.Lighting.CountDownTimer
                    local timer = game.Lighting.Timer
                    cdt.Value = "Active"
                    for i = 3, 0, -1 do
                        timer.Value = i
                        wait(3)
                        timer.Value = "GO!"
                        wait(1)
                        cdt.Value = "NotActive"
                    end 
                end
            end
        end
    end)
end)

function trigger()
    script.Parent.Parent.Part1.Transparency = 0
    script.Parent.Parent.Part1.CanCollide = true
    wait(.1)
    script.Parent.Parent.Part2.Transparency = 0
    script.Parent.Parent.Part2.CanCollide = true
    wait(.1)
    script.Parent.Parent.Part3.Transparency = 0
    script.Parent.Parent.Part3.CanCollide = true
    wait(.1)
    script.Parent.Parent.Part4.Transparency = 0
    script.Parent.Parent.Part4.CanCollide = true
    wait(.1)
    script.Parent.Parent.Part5.Transparency = 0
    script.Parent.Parent.Part5.CanCollide = true
    wait(.1)
    script.Parent.Parent.Part6.Transparency = 0
    script.Parent.Parent.Part6.CanCollide = true
    script.Parent.Parent.Parent.SFing.Part1.Transparency = 1
    script.Parent.Parent.Parent.SFing.Part1.CanCollide = false
end




0
Don't post multiple questions about the same script with the same problem, please. Everesty 1001 — 7y
0
I have edited the script, still doesn't work. Anyone see a problem or something that could be causing this to bug? wattleman 90 — 7y

1 answer

Log in to vote
3
Answered by
Everesty 1001 Moderation Voter
7 years ago

No, this script will not work.

The PlayerIsInGroup method takes a number, not a string, which you are putting in the "Groups" table.

On line 15 you are checking if the player is in the group with the id 50, then checking if their rank in group 50 is higher than or equal to 50. But, the fact is you tried to check for a different group previously.

On line 26 you define the Player as P1 but then try to use Player as the player, and P1 as a function. That would fail to work. Take out the part where you use P1 as a function and just keep the IsAdmin part. Also rename P1 to Player and you should be good to go on this part.

After edit: You're still trying to use the player as a function. Replace Player(isAdmin(Player)) with isAdmin(Player)

0
I edited it. Still doesn't work. wattleman 90 — 7y
Ad

Answer this question