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

Help with table.insert() and also CFrame?

Asked by 9 years ago

Im currently making a Tablet Admin its much more complex than most admins with guis and messages.


Commands={} Tablets={} --MakeCommandInstance This is what I use to make the Command run Cmd=function(Name,Command,Rank,Desc,Args,Func) if Name==nil or Name=='' then Name=('Name Unspecified') end if Command==nil or Command=='' then Command=('Command Unspecified') end if Rank==nil or Rank=='' then Rank=('Rank Unspecified') end if Desc==nil or Desc=='' then Desc=('Desc Unspecified') end if Args==nil or Args=='' then Args=('Args Unspecified') end table.insert(Commands, {NAME=Name,COMMAND=Command,RANK=Rank,DESC=Desc,ARGS=Args,FUNC = Func}) end function Tablet(Colr,Txt,Plr) --This is "Tablet" (This is used to replace Guis/Messages) local Tab=Instance.new('Part',workspace) Tab.Name=('[Output]') Tab.Anchored=true Tab.Locked=true Tab.CanCollide=false Tab.FormFactor=('Custom') Tab.TopSurface=('SmoothNoOutlines') Tab.BottomSurface=('SmoothNoOutlines') Tab.Size=Vector3.new(4,5,0.2) Tab.BrickColor=BrickColor.new(Colr) Tab.Transparency=0.3 local Light=Instance.new('PointLight',Tab) Light.Color=Color3.new(Colr) local Box=Instance.new('SelectionBox',Tab) Box.Transparency=0.3 Box.Color=Tab.BrickColor Box.Adornee=Tab local g=Instance.new("BillboardGui",Tab) g.Adornee=Tab g.Active=false g.Size=UDim2.new(12,0,6) g.StudsOffset=Vector3.new(0,4,0) local l=Instance.new("TextLabel",g) l.Size=UDim2.new(1,0,1,0) l.BackgroundTransparency=1 l.TextColor3=Color3.new(0,0,0) l.TextStrokeColor3=Color3.new(Colr) l.TextStrokeTransparency=1 l.Font="SourceSansBold" l.TextWrapped=true l.TextColor3=Color3.new(255,255,255) l.Active=false l.FontSize="Size18" l.Text=Txt g.ExtentsOffset=Vector3.new(0,0,1) local Click=Instance.new('ClickDetector',Tab) Click.MaxActivationDistance=math.huge Click.MouseClick:connect(function(Pl) if Pl==Plr then return Tab:Destroy() end end) table.insert(Tablets, {Tab=Tab,Box=Box,txt=l}) end -- Now for the problem Im having its the rot or else this "Tablet" will just sit on the ground and do -----nothing -- Rotation! -- TabletRotation = 0 UpdateTablets = function() TabletRotation = TabletRotation==360 and 0 or TabletRotation + 0.0002 for _, Player in pairs(All()) do local PlrTabs = {} for i,v in pairs(Tablets) do if v.Tab.Parent ~= nil and v.Plr == Player.Name then table.insert(PlrTabs, v) end end for i,v in pairs(PlrTabs) do pcall(function() local pos = nil pcall(function() if Player.Character.Parent == workspace then pos = Player.Character.Torso.CFrame end end) if pos == nil then return end local radius = 8 + (#PlrTabs * 0.5) local x,y,z x = math.sin((i / #PlrTabs - (0.5 / #PlrTabs) * 2) * math.pi * 2) * radius y = 0 z = math.cos((i / #PlrTabs - (0.5 / #PlrTabs) * 2) * math.pi * 2) * radius local arot = Vector3.new(x,y,z)+pos.p local brot = v.Tab.CFrame.p local crot = (arot * .1 + brot * .9) local drot = math.rad((TabletRotation * 1000) * math.pi) v.Tab.CFrame = CFrame.new(crot, pos.p) v.Tab.CFrame = v.Tab.CFrame * CFrame.Angles(drot, drot, drot) v.Tab.CFrame = v.Tab.CFrame * CFrame.Angles(math.pi/2,0,0) end) end end end
0
I cant give a Snippet because it all must work together for this to completly work. MessorAdmin 598 — 9y
0
Lol this is kinda a Snippet because the whole script is like 800+lines so far and it only has like 4commands :P MessorAdmin 598 — 9y
1
What is the current problem? BlackJPI 2658 — 9y
0
The "Tablet" doesnt CFrame to the current Player it needs to. MessorAdmin 598 — 9y

Answer this question