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

[Re-posted,Not Answered] CFraming a Instance(s)?

Asked by 9 years ago

I have been working on this rotation for about 3days and I cant figure it out.

How would I make this CFrame?

Tablets={}

function UpdateTablets(Plr)
pcall(function()
Rot=Rot+RotValue/100                
for i=1,#Tablets do
local pos=game.Players[Plr].Character.Torso.CFrame
local m=(i/#Tablets-(0.8/#Tablets)+(Tablets/(#Tablets/5)))*math.pi*2
local rad=(#Tablets*0.6)+5
local x=math.sin(m)*(rad)
local y=math.sin(time()/5)
local z=math.cos(m)*rad
local arot=Vector3.new(x,y,z)+pos.p
local brot=Tablets[i].Tab.CFrame.p
local crot=arot*0.1+brot *0.9
local d=math.rad((Rot*800)*math.pi)
Tablets[i].Tab.CFrame=CFrame.new(crot,pos.p)*CFrame.Angles(math.rad(15),d,0)
end
end)
end

Tablet=function(Player,Color,Text,Func)
if Player==nil then Player=game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())] end
if Color==nil then Color=('Institutional white') end
if Text==nil then Text=('Command Error') end
if Func==nil then Func=function() end end
local Tab=Instance.new('Part',workspace) Tab.Material=('Plastic')
Tab.Name=('[Output]') Tab.Anchored=true Tab.CanCollide=false Tab.Transparency=(0.3)
Tab.Locked=true Tab.FormFactor=('Custom') Tab.Size=Vector3.new(4,5,0.2) Tab.BrickColor=BrickColor.new(Color)
local Click=Instance.new('ClickDetector',Tab) Click.MaxActivationDistance=(math.huge)
local Light=Instance.new('PointLight',Tab) Light.Brightness=(1) Light.Color=Color3.new(255,255,255)
Light.Range=(8) Light.Shadows=false local Box=Instance.new('SelectionBox',Tab) Box.Color=Tab.BrickColor Box.Adornee=(Tab) Box.Transparency=(0.3)
Tab.Transparency=(0.5) local BG=Instance.new('BillboardGui',Tab) BG.Active=false BG.AlwaysOnTop=false
BG.ExtentsOffset=Vector3.new(0,0,1) BG.Size=UDim2.new(12,0,6,0) BG.StudsOffset=Vector3.new(0,4,0)
local Textlabel=Instance.new('TextLabel',BG) Textlabel.BackgroundTransparency=(1) 
Textlabel.Position=UDim2.new(0,0,0,0) Textlabel.Size=UDim2.new(1,0,1,0) Textlabel.Visible=true
Textlabel.Font=('SourceSansBold') Textlabel.FontSize=('Size18') Textlabel.Text=(Text) Textlabel.TextColor3=Color3.new(65025, 65025, 65025)
Textlabel.TextScaled=false Textlabel.TextWrapped=true
Click.MouseClick:connect(function(Pl)
if Pl==Player then Tab:destory() wait() UpdateTablets(Player) wait()
Func=Func
Func()
if not Func then
UpdateTablets(Player)
end
end
end)
table.insert(Tablets,{Tab=Tab,Box=Box,Text=Textlabel})
UpdateTablets(Player)
end

Answer this question