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

Need to make this group permission rather then name permission, if anyone can help?

Asked by 4 years ago
local permission = {"ClearlyDeveloped","WilliamAdley"}


local jail = game.Workspace.IsolationBlock.Block

local team = ""

function check(name)
    if table.maxn(permission) == 0 then return true end
        for i = 1,#permission do
        if (string.upper(name) == string.upper(permission[i])) then return true end
        end
    return false
end

function Jail(name)
    local player = game.Players:FindFirstChild(name)
    local torso = player.Character:FindFirstChild("Torso")
    if torso == nil then return end
        local location = {jail.Position}
        local i = 1

        local x = location[i].x
        local y = location[i].y
        local z = location[i].z

        x = x + math.random(-1, 1)
        z = z + math.random(-1, 1)
        y = y + math.random(2, 3)

        local cf = torso.CFrame
        local lx = 0
        local ly = y
        local lz = 0

    torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
end

function Team(name)
    local player = game.Players:FindFirstChild(name)
 local torso = player.Character:FindFirstChild("Torso")

player.TeamColor = game.Teams.Isolation.TeamColor

-- wait (1)
-- player.Character.HumanoidRootPart.Anchored = true 

end


function onChatted(msg, recipient, speaker)

    local source = string.lower(speaker.Name)
    msg = string.lower(msg)

    if not check(source) then return end

        if string.match(msg, "/iso") then
            local players=game.Players:GetChildren()


for _,player in pairs(players) do
    local Array = {}
    for i = 1,string.len(player.Name) do
        table.insert(Array,string.sub(player.Name,1,i))
    end
    for i,v in pairs(Array) do
        if string.match(msg,string.lower(v)) then
            Jail(player.Name)
            Team(player.Name)
        end
    end




        end
    end
end

function onPlayerEntered(newPlayer)
    newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)

0
something.. I forgot wait i'll open the WIKI Luka_Gaming07 534 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

player = A player Object in game.Players

use player:IsInGroup(Group Id)

in a LocalScript will Return a Up-to-date Boolean value, Whereas a ServerScript does not Return a Up-to-date Boolean value (e.g A player leaves a group. A ServerScript still thinks its in the group but the LocalScript not)

use the code in

if player:IsInGroup(Group Id) then
    --What Happens
end
Ad

Answer this question