ScratchData LogoScratchData
Back to -010_OTHER's profile

t r o l l e d

-0-010_OTHER•Created May 29, 2018
t r o l l e d
0
0
13 views
View on Scratch

Instructions

ArtificialHB = Instance.new("BindableEvent", script) ArtificialHB.Name = "Heartbeat" script:WaitForChild("Heartbeat") frame = 1 / 60 tf = 0 allowframeloss = false tossremainder = false lastframe = tick() script.Heartbeat:Fire() game:GetService("RunService").Heartbeat:connect(function(s, p) tf = tf + s if tf >= frame then if allowframeloss then script.Heartbeat:Fire() lastframe = tick() else for i = 1, math.floor(tf / frame) do script.Heartbeat:Fire() end lastframe = tick() end if tossremainder then tf = 0 else tf = tf - frame * math.floor(tf / frame) end end end)

Description

function swait(num) if num == 0 or num == nil then game:service("RunService").Stepped:wait(0) else for i = 0, num do game:service("RunService").Stepped:wait(0) end end end function thread(f) coroutine.resume(coroutine.create(f)) end function clerp(a, b, t) local qa = { QuaternionFromCFrame(a) } local qb = { QuaternionFromCFrame(b) } local ax, ay, az = a.x, a.y, a.z local bx, by, bz = b.x, b.y, b.z local _t = 1 - t return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t)) end function QuaternionFromCFrame(cf) local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() local trace = m00 + m11 + m22 if trace > 0 then local s = math.sqrt(1 + trace) local recip = 0.5 / s return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5 else local i = 0 if m00 < m11 then i = 1 end if m22 > (i == 0 and m00 or m11) then i = 2 end if i == 0 then local s = math.sqrt(m00 - m11 - m22 + 1) local recip = 0.5 / s return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip elseif i == 1 then local s = math.sqrt(m11 - m22 - m00 + 1) local recip = 0.5 / s return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip elseif i == 2 then local s = math.sqrt(m22 - m00 - m11 + 1) local recip = 0.5 / s return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip end end end function QuaternionToCFrame(px, py, pz, x, y, z, w) local xs, ys, zs = x + x, y + y, z + z local wx, wy, wz = w * xs, w * ys, w * zs local xx = x * xs local xy = x * ys local xz = x * zs local yy = y * ys local yz = y * zs local zz = z * zs return CFrame.new(px, py, pz, 1 - (yy + zz), xy - wz, xz + wy, xy + wz, 1 - (xx + zz), yz - wx, xz - wy, yz + wx, 1 - (xx + yy)) end function QuaternionSlerp(a, b, t) local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4] local startInterp, finishInterp if cosTheta >= 1.0E-4 then if 1 - cosTheta > 1.0E-4 then local theta = math.acos(cosTheta) local invSinTheta = 1 / Sin(theta) startInterp = Sin((1 - t) * theta) * invSinTheta finishInterp = Sin(t * theta) * invSinTheta else startInterp = 1 - t finishInterp = t end elseif 1 + cosTheta > 1.0E-4 then local theta = math.acos(-cosTheta) local invSinTheta = 1 / Sin(theta) startInterp = Sin((t - 1) * theta) * invSinTheta finishInterp = Sin(t * theta) * invSinTheta else startInterp = t - 1 finishInterp = t end return a[1] * startInterp + b[1] * finishInterp, a[2] * startInterp + b[2] * finishInterp, a[3] * startInterp + b[3] * finishInterp, a[4] * startInterp + b[4] * finishInterp end function rayCast(Position, Direction, Range, Ignore) return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore) end local RbxUtility = LoadLibrary("RbxUtility") local Create = RbxUtility.Create

Project Details

Project ID226272974
CreatedMay 29, 2018
Last ModifiedMay 29, 2018
SharedMay 29, 2018
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root