Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = Instance.new("Sound")
- s.PlayOnRemove = true
- s.SoundId = "rbxassetid://9118631941"
- local part = Instance.new("Part",script)
- part.CFrame = owner.Character.Head.CFrame
- part.Size = Vector3.new(1.5,1.5,1.5) * 1.8
- local part3 = Instance.new("Part",script)
- part3.CFrame = owner.Character.Head.CFrame
- part3.Size = Vector3.new(0.5,0.5,0.5)
- part3.CanCollide = false
- local decal = Instance.new("Decal", part3)
- decal.Face = Enum.NormalId.Front
- decal.Texture = owner.Character.Head.face.Texture
- local part2 = Instance.new("Part",script)
- part2.CFrame = owner.Character.Head.CFrame
- part2.Size = Vector3.new(2,2,2)
- part2.Shape = "Ball"
- part3.Color = owner.Character.Head.Color
- part.Color = owner.Character.Torso.Color
- part:SetNetworkOwner(owner)
- part2:SetNetworkOwner(owner)
- local m = Instance.new("SpecialMesh",part2)
- m.MeshId = "rbxassetid://10604848"
- m.TextureId = "rbxassetid://10605252"
- m.Scale = Vector3.new(0.65,0.65,0.65)
- m.Offset = Vector3.new(0,-4,0)
- local object = Instance.new("ObjectValue", owner.PlayerGui)
- object.Value = part
- object.Name = "part"
- local object = Instance.new("ObjectValue", owner.PlayerGui)
- object.Value = part2
- object.Name = "part2"
- local object = Instance.new("ObjectValue", owner.PlayerGui)
- object.Value = part3
- object.Name = "part3"
- e = Instance.new("RemoteEvent",owner.PlayerGui)
- e.OnServerEvent:Connect(function(_,force)
- if force > 1 then
- s.Pitch = 1 + math.random(-30,30)/200
- s.Volume = 0.8 + (force * 0.1)
- s.Parent = part2
- s.Parent = nil
- end
- end)
- local rightup = Instance.new("Part",script)
- rightup.CFrame = owner.Character.Head.CFrame * CFrame.new(1,7.5,0)
- rightup.Size = ((Vector3.new(0.234 * 0.75, 0.331,0.226 * 0.75) * 8) - Vector3.new(0,0.5,0)) * 0.75
- rightup.Color = owner.Character["Right Arm"].Color
- local righth = Instance.new("Part",script)
- righth.CFrame = owner.Character.Head.CFrame * CFrame.new(1,7.5,0)
- righth.Size = Vector3.new(0.75,0.75,0.75)
- righth.Shape = "Ball"
- righth.CanCollide = false
- righth.Material = "SmoothPlastic"
- righth.Color = owner.Character["Right Arm"].Color
- local lefth = Instance.new("Part",script)
- lefth.CFrame = owner.Character.Head.CFrame * CFrame.new(1,7.5,0)
- lefth.Size = Vector3.new(0.75,0.75,0.75)
- lefth.Shape = "Ball"
- lefth.CanCollide = false
- lefth.Material = "SmoothPlastic"
- lefth.Color = owner.Character["Left Arm"].Color
- local rightdown = Instance.new("Part",script)
- rightdown.CFrame = owner.Character.Head.CFrame * CFrame.new(1.25,5,0.125)
- rightdown.Size = ((Vector3.new(0.234 * 0.65, 0.461,0.226 * 0.65) * 8) - Vector3.new(0,0.5,0)) * 0.75
- rightdown.Color = owner.Character["Right Arm"].Color
- local leftup = Instance.new("Part",script)
- leftup.CFrame = owner.Character.Head.CFrame * CFrame.new(1,7.5,0)
- leftup.Size = ((Vector3.new(0.234 * 0.75, 0.331,0.226 * 0.75) * 8) - Vector3.new(0,0.5,0)) * 0.75
- leftup.Color = owner.Character["Left Arm"].Color
- local leftdown = Instance.new("Part",script)
- leftdown.CFrame = owner.Character.Head.CFrame * CFrame.new(1.25,5,0.125)
- leftdown.Size = ((Vector3.new(0.234 * 0.65, 0.461,0.226 * 0.65) * 8) - Vector3.new(0,0.5,0)) * 0.75
- leftdown.Color = owner.Character["Left Arm"].Color
- local w = Instance.new("Weld",rightdown)
- w.Part0 = righth
- w.Part1 = rightdown
- w.C1 = CFrame.new(0.1,-(rightdown.Size.Y * 0.75),0)
- local w = Instance.new("Weld",leftdown)
- w.Part0 = lefth
- w.Part1 = leftdown
- w.C1 = CFrame.new(-0.1,-(leftdown.Size.Y * 0.75),0)
- local m = Instance.new("SpecialMesh",leftup)
- m.MeshId = "rbxassetid://2337186767"
- m.Scale = Vector3.new(3,3,3) * 0.75
- m.Offset = Vector3.new(0.5,0,0) * 0.75
- local m = Instance.new("SpecialMesh",part)
- m.MeshId = "rbxassetid://2337186836"
- m.Scale = Vector3.new(2.5,2.5,2.5) * 0.75
- local m = Instance.new("SpecialMesh",part3)
- m.MeshId = "rbxassetid://2337186646"
- m.Scale = Vector3.new(2.5,2.5,2.5) * 0.75
- local m = Instance.new("SpecialMesh",leftdown)
- m.MeshId = "rbxassetid://2337186757"
- m.Scale = Vector3.new(3,3,3) * 0.75
- local m = Instance.new("SpecialMesh",rightup)
- m.MeshId = "rbxassetid://2337186817"
- m.Scale = Vector3.new(3,3,3) * 0.75
- m.Offset = Vector3.new(-0.5,0,0) * 0.75
- local m = Instance.new("SpecialMesh",rightdown)
- m.MeshId = "rbxassetid://2337186800"
- m.Scale = Vector3.new(3,3,3) * 0.75
- local nocol = Instance.new("NoCollisionConstraint",part)
- nocol.Part1 = part2
- nocol.Part0 = part
- leftdown.CanCollide = false
- leftup.CanCollide = false
- rightup.CanCollide = false
- rightdown.CanCollide = false
- local o = Instance.new("ObjectValue", owner.PlayerGui)
- o.Value = leftup
- o.Name = "lu"
- local o = Instance.new("ObjectValue", owner.PlayerGui)
- o.Value = leftdown
- o.Name = "ld"
- local o = Instance.new("ObjectValue", owner.PlayerGui)
- o.Value = rightup
- o.Name = "ru"
- local o = Instance.new("ObjectValue", owner.PlayerGui)
- o.Value = rightdown
- o.Name = "rd"
- local o = Instance.new("ObjectValue", owner.PlayerGui)
- o.Value = lefth
- o.Name = "lh"
- local o = Instance.new("ObjectValue", owner.PlayerGui)
- o.Value = righth
- o.Name = "rh"
- function float(wha)
- local bv = Instance.new("BodyVelocity",wha)
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Velocity = Vector3.new()
- end
- float(leftup)
- float(leftdown)
- float(rightup)
- float(rightdown)
- float(part3)
- for i,v in pairs(script:GetDescendants()) do
- pcall(function()
- v:SetNetworkOwner(owner)
- end)
- end
- NLS([[
- workspace.CurrentCamera.CameraType = "Scriptable"
- e = script.Parent
- m = owner:GetMouse()
- local dist = 8
- local active = 0
- m.KeyDown:Connect(function(key)
- key = key:lower()
- if key == "q" then
- active = 1
- elseif key == "e" then
- active = -1
- end
- end)
- m.KeyUp:Connect(function(key)
- key = key:lower()
- if key == "q" or key == "e" then
- active = 0
- end
- end)
- coroutine.wrap(function()
- while task.wait() do
- if workspace.CurrentCamera.CameraType ~= "Scriptable" then
- if active == 1 then
- dist = math.clamp(dist + 0.2,6.5,8.5)
- elseif active == -1 then
- dist = math.clamp(dist - 0.2,6.5,8.5)
- end
- end
- end
- end)()
- local part = owner.PlayerGui.part.Value
- local part2 = owner.PlayerGui.part2.Value
- local part3 = owner.PlayerGui.part3.Value
- local hand1 = owner.PlayerGui.lh.Value
- local hand2 = owner.PlayerGui.rh.Value
- workspace.CurrentCamera.CameraSubject = part3
- local at0 = Instance.new("Attachment",part2)
- local at1 = Instance.new("Attachment",workspace.Terrain)
- local at2 = Instance.new("Attachment",workspace.Terrain)
- local at3 = Instance.new("Attachment",part)
- local align = Instance.new("AlignPosition",part)
- align.Attachment0 = at0
- align.Attachment1 = at1
- align.Responsiveness = 200
- local align2 = Instance.new("AlignOrientation",part)
- align2.Attachment0 = at0
- align2.Attachment1 = at1
- align2.RigidityEnabled = true
- local align3 = Instance.new("AlignOrientation",part)
- align3.Attachment0 = at3
- align3.Attachment1 = at2
- align3.RigidityEnabled = true
- at0.CFrame = CFrame.Angles(math.rad(90),0,0)
- function spring_movement(spring_constant, mass, displacement)
- local force = spring_constant * displacement
- local acceleration = force / mass
- return acceleration
- end
- local uis = game:GetService("UserInputService")
- local lastis = false
- function solveIK(originCF, targetPos, l1, l2)
- -- build intial values for solving
- local localized = originCF:pointToObjectSpace(targetPos)
- local localizedUnit = localized.unit
- local l3 = localized.magnitude
- local axis = Vector3.new(0,0,-1):Cross(localizedUnit)
- local angle = math.acos(-localizedUnit.Z)
- local planeCF = originCF * CFrame.fromAxisAngle(axis, angle)
- -- case: point is to close, unreachable
- -- return: push back planeCF so the "hand" still reaches, angles fully compressed
- if l3 < math.max(l2, l1) - math.min(l2, l1) then
- return planeCF * CFrame.new(0, 0, math.max(l2, l1) - math.min(l2, l1) - l3), -math.pi/2, math.pi
- -- case: point is to far, unreachable
- -- return: for forward planeCF so the "hand" still reaches, angles fully extended
- elseif l3 > l1 + l2 then
- return planeCF * CFrame.new(0, 0, math.clamp(l1 + l2 - l3,0,0.01)), math.pi/2, 0
- -- case: point is reachable
- -- return: planeCF is fine, solve the angles of the triangle
- else
- local a1 = -math.acos((-(l2 * l2) + (l1 * l1) + (l3 * l3)) / (2 * l1 * l3))
- local a2 = math.acos(((l2 * l2) - (l1 * l1) + (l3 * l3)) / (2 * l2 * l3))
- return planeCF, a1 + math.pi/2, a2 - a1
- end
- end
- local leftup = owner.PlayerGui.lu.Value
- local leftdown = owner.PlayerGui.ld.Value
- local rightup = owner.PlayerGui.ru.Value
- local rightdown = owner.PlayerGui.rd.Value
- local VECTOR3_UP = Vector3.new(0, 1, 0)
- part2.Transparency = 0.6
- part3.Transparency = 0.6
- part.Transparency = 0.6
- hand2.Transparency = 0.6
- hand1.Transparency = 0.6
- leftup.Transparency = 0.6
- rightup.Transparency = 0.6
- rightdown.Transparency = 0.6
- leftdown.Transparency = 0.6
- part2.Material = "ForceField"
- local blur = Instance.new("BlurEffect",game:GetService("Lighting"))
- dist = 4
- workspace.CurrentCamera.CFrame = part.CFrame * CFrame.new(0,12,7)
- local bv = Instance.new("BodyVelocity",part)
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Velocity = Vector3.new()
- coroutine.wrap(function()
- workspace.CurrentCamera.CFrame = part.CFrame * CFrame.new(0,12,7)
- workspace.CurrentCamera.FieldOfView = 40
- blur.Size = 15
- wait(1)
- local tweenService = game:GetService("TweenService")
- local timeToFade = 2
- local object = workspace.CurrentCamera
- local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Quad,Enum.EasingDirection.In)
- local goal = {}
- goal.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0,-10,0)
- goal.FieldOfView = 70
- local camt = tweenService:Create(object, tweenInfo, goal)
- camt:Play()
- local tweenService = game:GetService("TweenService")
- local timeToFade = 1
- local object = blur
- local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Quad,Enum.EasingDirection.In)
- local goal = {}
- goal.Size = 0
- local camt2 = tweenService:Create(object, tweenInfo, goal)
- camt2:Play()
- camt.Completed:Wait()
- blur:Destroy()
- for i = 1,10 do
- dist = dist + (2/10)
- task.wait()
- end
- wait(1)
- workspace.CurrentCamera.CameraType = "Custom"
- bv.MaxForce = Vector3.new(0,part:GetMass() * 0.1,0)
- local bv = Instance.new("BodyVelocity",part2)
- bv.MaxForce = Vector3.new(0,part2:GetMass() * 0.1,0)
- bv.Velocity = Vector3.new()
- end)()
- coroutine.wrap(function()
- while task.wait() do
- if part.Velocity.Magnitude > 16 then
- workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position + part.Velocity * owner:GetNetworkPing()) * CFrame.Angles(workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ())
- workspace.CurrentCamera.FieldOfView = 70 + (part.Velocity.Magnitude * 0.1)
- else
- workspace.CurrentCamera.FieldOfView = 70
- end
- end
- end)()
- while game:GetService("RunService").RenderStepped:Wait() do
- local _,y,_ = workspace.CurrentCamera.CFrame:ToOrientation()
- at1.WorldCFrame = CFrame.new(part.Position) * CFrame.Angles(workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ()) * CFrame.new(0,0.125,-dist)
- part3.CFrame = (CFrame.new((part.CFrame * CFrame.new(0,1.75 * 0.75,0)).Position) * CFrame.Angles(workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ())) * CFrame.new(0,1 * 0.75,0)
- at2.WorldCFrame = CFrame.new(part.Position) * CFrame.Angles(0,y,0)
- coroutine.wrap(function()
- local goalPosition = (part2.CFrame * CFrame.new(0.1,-4,0.125)).Position
- local goalPosition2 = (part2.CFrame * CFrame.new(-0.1,-5.5,0.0625)).Position
- local upperV3 = VECTOR3_UP * leftup.Size
- local lowerV3 = VECTOR3_UP * leftdown.Size
- local upper2V3 = VECTOR3_UP * rightup.Size
- local lower2V3 = VECTOR3_UP * rightdown.Size
- local planeCF, shoulderAngle, elbowAngle = solveIK(part.CFrame * CFrame.new(-1.5 * 0.75,0.25,0), goalPosition, upperV3.Y, lowerV3.Y)
- local planeCF2, shoulderAngle2, elbowAngle2 = solveIK(part.CFrame * CFrame.new(1.5 * 0.75,0.25,0), goalPosition2, upper2V3.Y, lower2V3.Y)
- local shoulderAngleCFrame = CFrame.Angles(shoulderAngle, 0, 0)
- local elbowAngleAngleCFrame = CFrame.Angles(elbowAngle, 0, 0)
- local shoulderAngleCFrame2 = CFrame.Angles(shoulderAngle2, 0, 0)
- local elbowAngleAngleCFrame2 = CFrame.Angles(elbowAngle2, 0, 0)
- leftup.CFrame = planeCF * CFrame.new(-1.5 * 0.75,0.25,0) * shoulderAngleCFrame * CFrame.new(-upperV3 * 0.85)
- leftdown.CFrame = leftup.CFrame * CFrame.new(-lowerV3 * 0.5) * elbowAngleAngleCFrame * CFrame.new(-lowerV3 * 0.65)
- rightup.CFrame = planeCF2 * CFrame.new(1.5 * 0.75,0.25,0) * shoulderAngleCFrame2 * CFrame.new(-upper2V3 * 0.85)
- rightdown.CFrame = rightup.CFrame * CFrame.new(-lower2V3 * 0.5) * elbowAngleAngleCFrame2 * CFrame.new(-lower2V3 * 0.65)
- end)()
- if workspace.CurrentCamera.CameraType ~= "Scriptable" then
- local vel = math.clamp(spring_movement(150,part:GetMass() * 1.05,((at1.WorldPosition - part2.Position)).Magnitude),-30 * 3,30 * 3)
- vel = -vel
- local a = part2:GetTouchingParts()
- local is = false
- if #a > 0 then
- for i,v in pairs(a) do
- if v.CanCollide == true and v.Parent ~= part.Parent then
- is = true
- end
- end
- end
- if is and not lastis then
- e:FireServer(-vel * 0.5)
- lastis = true
- end
- if is == true then
- part.Velocity = part.Velocity * 0.7 + ((CFrame.Angles(CFrame.new(part2.Position,at1.WorldPosition):ToEulerAnglesXYZ()).lookVector * vel))
- part2.Velocity = part.Velocity
- part3.Velocity = part.Velocity * 2
- else
- if lastis then
- part.Velocity = part.Velocity * 0.7 + ((CFrame.Angles(CFrame.new(part2.Position,at1.WorldPosition):ToEulerAnglesXYZ()).lookVector * vel))
- part2.Velocity = part.Velocity
- part3.Velocity = part.Velocity * 2
- lastis = false
- end
- end
- end
- end
- ]],e)
- owner.Character.Parent = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement