What I mean: I have created a command for my A.C. (Admin Commands), however, the command is not working as it is supposed to, although, as it is executing the command, the for
loop is not looping properly through the Hologram, as the face
, HumanoidRootPart
, and Hat(s)
are appearing up in the Hologram when not supposed to, I have even set a Wait
to wait before starting the for
loop, however, that did not prevent from the face
, HumanoidRootPart
, nor the Hat(s)
from showing up either, however, it is setting the Transparency
, and BrickColor
for the BasePart
's, which is what it is also supposed to do, but, I am confused to why it won't do the same for the rest of the things I listed (The face
, HumanoidRootPart
, and Hat(s)
).
This is the code I am using for the Hologram
(Note, this is the entire Hologram code :) );
if msg:lower():sub(1,9+#Prefix) == Prefix.."hologram " then local plrz = GetPlr(plr,msg:sub(10+#Prefix)); print("Hologram 1:",#plrz) for i,v in pairs(plrz) do print("Hologram 2") coroutine.resume(coroutine.create(function() print("Hologram 3") if v.Character then v.Character.Archivable = true local char = v.Character:Clone() char.Parent = Services['Workspace'] char:MakeJoints() char.Name = v.Name.."HOLOGRAM" char:MoveTo(v.Character:GetModelCFrame().p+Vector3.new(0,1,0)) table.insert(Container,char) wait(.5) for i2,v2 in pairs(char:GetChildren()) do if v2:IsA("BasePart") then v2.BrickColor = BrickColor.new("Teal") v2.Transparency = 0.1 elseif v2:IsA("Hat") and v2:FindFirstChild("Handle") then if v2:FindFirstChild("Mesh") then v2.Mesh.TextureId = "http://" v2.VertexColor.X = 0 v2.VertexColor.Y = 1 v2.VertexColor.Z = 1 end v2.Handle.BrickColor = BrickColor.new("Teal") v2.Handle.Transparency = 0.1 elseif v2:FindFirstChild("face") then v2.face:Destroy() wait(1/13.37) if v2:FindFirstChild("face") then v2.face.Texture = "http://" v2.face.Transparency = 1 end elseif v2.Name == "HumanoidRootPart" then v2.Transparency = 1 end end v.Character.Archivable = false end end)) end end
I got this code working hardly in any time at all, it was a simple mistake; the .Chatted connection. :P
I would also recommand using my GetPlr function, I made mine so even if your msg is a nil it will refer to you.
local Prefix = "!" local Container = {} local GetPlr=function(Plr,Msg) local ReturnedTable={} -- Use mine if you would like. if Msg:lower()=='me' or Msg=='' then table.insert(ReturnedTable,Plr) elseif Msg:lower()=='all' then coroutine.wrap(function() for _,v in pairs(game.Players:GetPlayers()) do table.insert(ReturnedTable,v) end end)() elseif Msg:lower()=='others' then for _,v in pairs(game.Players:GetPlayers()) do if v.Name~=Plr.Name then table.insert(ReturnedTable,v) end end elseif Msg:lower()=='friends' then for _,v in pairs(game.Players:GetPlayers()) do if v:IsFriendsWith(Plr.userId) then table.insert(ReturnedTable,v) end end elseif Msg:lower()=='bestfriends' then for _,v in pairs(game.Players:GetPlayers()) do if v:IsBestFriendsWith(Plr.userId) then table.insert(ReturnedTable,v) end end elseif Msg:lower()=='nonfriends' then for _,v in pairs(game.Players:GetPlayers()) do if not v:IsFriendsWith(Plr.userId) then table.insert(ReturnedTable,v) end end elseif Msg:lower()=='nonbestfriends' then for _,v in pairs(game.Players:GetPlayers()) do if not v:IsBestFriendsWith(Plr.userId) then table.insert(ReturnedTable,v) end end elseif Msg:lower()=='nbc' then for _,v in pairs(game.Players:GetPlayers()) do if v.MembershipType == Enum.MembershipType.None then table.insert(ReturnedTable,v) end end elseif Msg:lower()=='tbc' then for _,v in pairs(game.Players:GetPlayers()) do if v.MembershipType == Enum.MembershipType.TurboBuildersClub then table.insert(ReturnedTable,v) end end elseif Msg:lower()=='obc' then for _,v in pairs(game.Players:GetPlayers()) do if v.MembershipType == Enum.MembershipType.OutrageousBuildersClub then table.insert(ReturnedTable,v)end end elseif Msg:lower()=='anybc' then for _,v in pairs(game.Players:GetPlayers()) do if v.MembershipType==Enum.MembershipType.BuildersClub then elseif v.MembershipType==Enum.MembershipType.TurboBuildersClub then elseif v.MembershipType==Enum.MembershipType.OutrageousBuildersClub then table.insert(ReturnedTable,v) end end else for _,v in pairs(game.Players:GetPlayers()) do local NM=v.Name:lower() local Msg=Msg:lower() if NM:sub(1,5):lower():find(Msg) then table.insert(ReturnedTable,v) end end end wait() return ReturnedTable end CheckChat = function(plr,msg) if msg:lower():sub(1 ,9+#Prefix ) == Prefix.."hologram " then -- !hologram<spacehere> local plrz = GetPlr(plr,msg:sub(10+#Prefix)); print("Hologram 1:",#plrz) for i,v in pairs(plrz) do print("Hologram 2") coroutine.resume(coroutine.create(function() print("Hologram 3") local rc,ec = ypcall(function() if v.Character then v.Character.Archivable = true local char = v.Character:Clone() char.Parent = workspace char:MakeJoints() char.Name = v.Name.."HOLOGRAM" char:MoveTo(v.Character:GetModelCFrame().p+Vector3.new(0,1,0)) table.insert(Container,char) wait(.5) for i2,v2 in pairs(workspace[char.Name]:GetChildren()) do if v2.ClassName == 'Part' and v2:IsA('BasePart') then v2.BrickColor = BrickColor.new('Teal') v2.Transparency = tonumber( .1 ) end if v2.ClassName == 'Hat' and v2:FindFirstChild('Handle',true) then if v2.Handle:FindFirstChild('Mesh',true) then v2.Handle.Mesh.TextureId = "" end end if v2.ClassName == 'Shirt' then v2:remove() end if v2.ClassName == 'Pants' then v2:remove() end if v2.ClassName == 'ShirtGraphic' then v2:remove() end if v2:FindFirstChild('Head',true) and v2.Head:FindFirstChild('face',true) then v2.Head.face.Texture = '' v2.Head.face.Transparency = 1 end end v.Character.Archivable = false end end) if not rc then warn( tostring(ec) ) end end)) end end end game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) CheckChat(plr,msg) end) end)