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

Why is the Tablet not correctly CFraming?

Asked by 10 years ago
Tablets={}

    function Tablet(Colr,Txt,Plr)
        local TabModel=Instance.new('Model',workspace)
        local Tab=Instance.new('Part',TabModel) 
        Tab.Anchored=true 
        Tab.Locked=true 
        Tab.CanCollide=false 
        Tab.FormFactor=('Custom') 
        Tab.Size=Vector3.new(4,5,0.2)
        Tab.BrickColor=BrickColor.new(Colr) 
        Tab.Transparency=0.3
        local Click=Instance.new('ClickDetector',Tab) 
        Click.MaxActivationDistance=math.huge
        Click.MouseClick:connect(function(Pl) if Plr==Plr then Tab:Destroy()
        ----------------------------------
        end
        end)
        table.insert(Tablets,TabModel)
    end

local starttime = tick()

game:GetService("RunService").Heartbeat:connect(function()
        ypcall(function()
            for _,Player in pairs(game.Players:GetPlayers()) do
                local PlayerTablets = {}
                for i,v in pairs(Tablets) do
                    if v.TabModel.Parent ~= nil and v.Tab.Parent ~= nil and v.Plr == Player.Name then
                        table.insert(PlayerTablets, v)
                    end
                end
                for i = 1, #PlayerTablets do
                    ypcall(function()
                        local tab = PlayerTablets[i].Tab
                        local pos = nil
                        ypcall(function()
                            pos = Player.Character.Head.CFrame
                        end)
                        local x = math.sin(time()/#PlayerTablets + (math.pi*2)/#PlayerTablets*i) * (#PlayerTablets+6)
                        local z = math.cos(time()/#PlayerTablets + (math.pi*2)/#PlayerTablets*i) * (#PlayerTablets+6)
                        local cPos = tab.Position
                        local ePos = Vector3.new(x, 0, z) + (pos.p or Vector3.new(0, -5, 0))
                        local nPos = (ePos-cPos)*.25
                        cPos = cPos + nPos
                        local t = (tick() - starttime) % 360
                        local change = 0.625
                        PlayerTablets[i].Size = math.sin(t) * change + 2.375
                        tab.CFrame = CFrame.new(cPos,cPos,cPos)
                        tab.CFrame = CFrame.new(cPos, (pos.p or Vector3.new(0, -5, 0))) * CFrame.Angles(math.rad(11.25), 0, 0)
                    end)
                end
            end
        end)
end)


wait(5)
for _, Plr in pairs(game.Players:GetPlayers()) do
Tablet('Lime green','TESTING TABLET ROT' or tostring(error),Plr)
end
1
If it were advanced, you would not have an error. Also, provice SNIPPETS of code. Not the whole script. Dominical 215 — 10y
0
provide* Dominical 215 — 10y
0
Unless of course all the code is only like 5 lines long. Perci1 4988 — 10y
0
Eh Dominical IT IS SNIPPETS. MessorAdmin 598 — 10y

Answer this question