Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gPlayers = game.Players
- local Murderer = ""
- local Sheriff = ""
- --[[
- By Relatively
- Commands
- twisted.roles displays roles to all players at top of screen
- twisted.mute [p] mutes [p]
- twisted.unmute [p] unmutes [p]
- twisted.mode [s] changes the mode at the top of the screen to [s].
- ]]--
- --[[ checkRole by eZaF/Murphy ]]--
- function checkRole(plr, role)
- for i,v in pairs(workspace:children()) do
- if v:IsA("Model") and v:findFirstChild("Humanoid") then
- if v:findFirstChild("Role") then
- if v.Role ~= nil and v.Role.Value == role then
- if v.Name:lower() == plr.Name:lower() then
- return true
- end
- end
- end
- end
- end
- end
- --[[ getPlayer by Chirality ]]--
- local function getPlayer(name)
- local nameTable = {}
- if name == "me" then
- nameTable[1] = admin
- elseif name == "all" then
- for i,v in pairs(gPlayers:GetChildren()) do
- nameTable[i] = v.Name
- end
- elseif name == "others" then
- for i,v in pairs(gPlayers:GetChildren()) do
- if v.Name ~= admin then
- nameTable[i] = v.Name
- end
- end
- else
- for i,v in pairs(gPlayers:GetChildren()) do
- local lname = v.Name:lower()
- local i,j = lname:find(name)
- if i == 1 then
- nameTable[1] = v.Name
- end
- end
- end
- return nameTable
- end
- --[[ setMode by Relatively ]]--
- function setMode(mode)
- game.Workspace.GameInProgress.Mode.Value = mode
- end
- --[[ refresh by Relatively ]]--
- function refresh()
- for i,h in pairs(game.Players:GetChildren()) do
- local char = h.Character
- local humanoi = char:FindFirstChild("Humanoid")
- if humanoi then
- if checkRole(h, "Murderer") then
- Murderer = h.Name
- elseif checkRole(h, "Sheriff") then
- Sheriff = h.Name
- else
- end
- end
- end
- setMode("Murderer: "..Murderer.." Sheriff: "..Sheriff)
- end
- SetCommandCallback(function(msg)
- if msg == "twisted.roles" then
- refresh()
- elseif msg:sub(1,12) == "twisted.mute" then
- local players = getPlayer(msg:sub(14))
- if players ~= nil then
- for i, v in pairs(players) do
- game.Players[v].Muted.Value = true
- end
- end
- elseif msg:sub(1,14) == "twisted.unmute" then
- local players = getPlayer(msg:sub(16))
- if players ~= nil then
- for i, v in pairs(players) do
- game.Players[v].Muted.Value = false
- end
- end
- elseif msg:sub(1,13) == "twisted.muted" then
- local players = getPlayer(msg:sub(15))
- if players ~= nil then
- for i, v in pairs(players) do
- print(v.Name..": "..game.Players[v].Muted.Value)
- end
- end
- elseif msg:sub(1,12)=="twisted.mode" then
- setMode(msg:sub(14))
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement