|
Hey guys, I would like to replace the CreatorID with a Username. Like done with the ADMIN.
Except I don't really know how to do that, I had a friend make this script for me ages ago. Script seems to still slightly work. Anyway, here's my script.
---->Script<----
_G.Adminlist = {"Player1"}
_G.Mutelist = {}
Banlist = {}
Chat = {}
MaxChat = 6
function new(newPlayer)
while newPlayer.Character == nil do
wait()
end
gui(newPlayer)
respawn(newPlayer)
newPlayer.Chatted:connect(function (msg) _G.chat(msg,newPlayer.Name) end)
if newPlayer.userId == game.CreatorId then
_G.chat(newPlayer.Name.." [Creator] has joined the server.","Game")
_G.setAdmin(newPlayer)
end
if checkAdmin(newPlayer.Name) == true then
_G.chat(newPlayer.Name.." [Admin] has joined the server.","Game")
_G.setAdmin(newPlayer)
end
end
function respawn(Player)
Player.Character.Humanoid.Died:connect(function () wait(5) respawn(Player) gui(Player) end)
if Player.userId == game.CreatorId then
Player.Character.Humanoid.Died:connect(function () wait(5) guiAdmin(Player) end)
end
if checkAdmin(Player.Name) == true then
Player.Character.Humanoid.Died:connect(function () wait(5) guiAdmin(Player) end)
end
end
function _G.setAdmin(Player)
_G.chat(Player.Name.." is now an admin.","Game")
guiAdmin(Player)
end
function guiAdmin(Player)
New = script.AdminGui:Clone()
New.Parent = Player.PlayerGui
end
function gui(Player)
S = Instance.new("ScreenGui")
S.Name = "ChattingGui"
S.Parent = Player.PlayerGui
F = Instance.new("Frame")
F.BackgroundTransparency = 1
F.Parent = S
F.Position = UDim2.new(0,40,0,40)
F.Size = UDim2.new(0, 0, 0, 100)
end
function checkAdmin(PlayerName)
for i = 1,#_G.Adminlist do
if string.lower(_G.Adminlist[i]) == string.lower(PlayerName) then
print("Admin!")
return true
end
end
end
function updateChat(Player,Msg)
NewMsg = Player.." : "..Msg
GUIs = {}
Players = game.Players:GetChildren()
for i = 1,#Players do
if Players[i]:FindFirstChild("PlayerGui") ~= nil and Players[i].PlayerGui:FindFirstChild("ChattingGui") ~= nil then
table.insert(GUIs,Players[i].PlayerGui.ChattingGui)
end
end
for i = 1,#GUIs do
Stuff = GUIs[i].Frame:GetChildren()
for i2 = 1,#Stuff do
Stuff[i2]:Remove()
end
end
Gui = Instance.new("TextLabel")
Gui.BackgroundTransparency = 0.5
Gui.TextColor3 = Color3.new(255/255,255/255,255/255)
Gui.TextXAlignment = 0
Gui.Font = 1
Gui.FontSize = 6
for i = 1,#GUIs do
for i2 = 1,#Chat do
GUI = Gui:Clone()
GUI.Size = UDim2.new(0,#Chat[i2]*10,0,20)
GUI.Position = UDim2.new(0,0,0,(i2*20)-20)
GUI.Text = string.gsub(" "..Chat[i2]," "," ")
GUI.Text = string.gsub(" "..Chat[i2]," "," ")
GUI.Text = string.gsub(" "..Chat[i2],"£"," ")
GUI.Parent = GUIs[i].Frame
end
end
end
function getName(msg)
print(msg)
bob = true
sub = nil
for i = 1,#msg do
if string.sub(msg,i,i) == ":" and bob == true then
print("Found")
bob = false
sub = i
end
end
print(string.sub(msg,2,sub-2))
return string.sub(msg,2,sub-2)
end
function muted(Player)
playerName = Player.Name
for i = 1,#_G.Mutelist do
print(_G.Mutelist[i].Name)
if string.lower(playerName) == string.lower(_G.Mutelist[i].Name) then
return true
end
end
end
function _G.chat(msg,playerName)
Mute = false
for i = 1,#_G.Mutelist do
print(_G.Mutelist[i].Name)
if string.lower(playerName) == string.lower(_G.Mutelist[i].Name) then
Mute = true
print("Fail")
end
end
if Mute == false then
if #Chat > MaxChat-1 then
table.remove(Chat,1)
end
MSG = playerName.." : "..msg
if game.Players:FindFirstChild(playerName) ~= nil and checkAdmin(playerName) == true then
MSG = playerName .." [Admin] : "..msg
end
if game.Players:FindFirstChild(playerName) ~= nil and game.Players[playerName].userId == game.CreatorId then
MSG = playerName .." [Creator] : "..msg
end
table.insert(Chat,MSG)
updateChat(playerName,msg)
end
end
game.Players.PlayerAdded:connect(new)
new(game.Players.IridiumKills)
---->End of Script<----
Thanks in advance!
-Mario(IridiumKills) |