wanTH092

Realistic Watch

Jul 4th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.53 KB | None | 0 0
  1. --[[
  2. Watch
  3. Zomg a watch.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. ModelName = "Watch"
  11. Player = Game.Players.LocalPlayer
  12. Char = Player.Character
  13. animate = Char:findFirstChild("Animate")
  14. if animate then
  15. animate:Destroy()
  16. end
  17. Selected = false
  18. Connected = false
  19. Button1Down = false
  20. CanUse = true
  21. WatchColor = BrickColor.new("Navy blue")
  22. FaceColor = BrickColor.new("Navy blue")
  23. FaceBackColor = BrickColor.new("Really black")
  24. CenterHandColor = BrickColor.new("Navy blue")
  25. NotchColor1 = BrickColor.new("Bright green")
  26. NotchColor2 = BrickColor.new("Bright green")
  27. HourHandColor = BrickColor.new("Navy blue")
  28. MinuteHandColor = BrickColor.new("Navy blue")
  29. SecondHandColor = BrickColor.new("Really red")
  30.  
  31.  
  32.  
  33. function CheckPlayer()
  34.     if Player.Character == nil then return false end
  35.     if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  36.     if Player.Character.Humanoid.Health <= 0 then return false end
  37.     return true
  38. end
  39.  
  40.  
  41.  
  42.  
  43. function Time()
  44.     local Hours = math.floor((tick() / 3600) % 24)
  45.     local Minutes = math.floor((tick() % 3600) / 60)
  46.     local Seconds = math.floor(tick() % 60)
  47.     local Section = ""
  48.     if Hours == 24 or Hours < 12 then
  49.         Section = "AM"
  50.     else
  51.         Section = "PM"
  52.     end
  53.     if Hours > 12 then
  54.         Hours = Hours - 12
  55.     end
  56.     if Minutes <= 9 then
  57.         Minutes = "0" ..tostring(Minutes)
  58.     end
  59.     if Seconds <= 9 then
  60.         Seconds = "0" ..tostring(Seconds)
  61.     end
  62.     return Hours, Minutes, Seconds, Section
  63. end
  64.  
  65.  
  66. function CreateParts(Parent, Format)
  67.     if Parent == nil then return end
  68.     local Parts = Instance.new("Model")
  69.     Parts.Name = ModelName
  70.     if Format == 1 then
  71.         Parts.Name = Parts.Name.. " (Holstered)"
  72.     end
  73.     Parts.Parent = Player.Character
  74.  
  75.     local MasterPart1 = Instance.new("Part")
  76.     MasterPart1.Material = "SmoothPlastic"
  77.     MasterPart1.Name = "Handle"
  78.     MasterPart1.FormFactor = "Custom"
  79.     MasterPart1.Size = Vector3.new(1.1, 0.2, 1.1)
  80.     MasterPart1.BrickColor = WatchColor
  81.     MasterPart1.TopSurface = 0
  82.     MasterPart1.BottomSurface = 0
  83.     MasterPart1.Parent = Parts
  84.     Instance.new("BlockMesh", MasterPart1)
  85.     local Weld = Instance.new("Weld", MasterPart1)
  86.     Weld.Part0 = Weld.Parent
  87.     Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  88.     Weld.C0 = CFrame.new(0, 0.7, 0)
  89.  
  90.     local MasterPart2 = Instance.new("Part")
  91.     MasterPart2.Material = "SmoothPlastic"
  92.     MasterPart2.Name = "Watch"
  93.     MasterPart2.FormFactor = "Custom"
  94.     MasterPart2.Size = Vector3.new(0.5, 0.21, 0.5)
  95.     MasterPart2.BrickColor = WatchColor
  96.     MasterPart2.TopSurface = 0
  97.     MasterPart2.BottomSurface = 0
  98.     MasterPart2.Parent = Parts
  99.     Instance.new("CylinderMesh", MasterPart2)
  100.     local Weld = Instance.new("Weld", MasterPart2)
  101.     Weld.Part0 = Weld.Parent
  102.     Weld.Part1 = MasterPart1
  103.     Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(90), 0) * CFrame.new(-0.5, 0, 0)
  104.  
  105.     for i = 0, 360, 15 do
  106.         local Part = Instance.new("Part")
  107.         Part.Material = "SmoothPlastic"
  108.         Part.Name = "Face Rim"
  109.         Part.FormFactor = "Custom"
  110.         Part.Size = Vector3.new(0.2, 0.2, 0.2)
  111.         Part.BrickColor = WatchColor
  112.         Part.TopSurface = 0
  113.         Part.BottomSurface = 0
  114.         Part.Parent = Parts
  115.         Instance.new("BlockMesh", Part).Scale = Vector3.new(0.065 / 0.2, 0.03 / 0.2, 0.05 / 0.2)
  116.         local Weld = Instance.new("Weld", Part)
  117.         Weld.Part0 = Weld.Parent
  118.         Weld.Part1 = MasterPart2
  119.         Weld.C0 = CFrame.new(0, 0.12, 0.224) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0)
  120.     end
  121.  
  122.     local Part = Instance.new("Part")
  123.     Part.Material = "SmoothPlastic"
  124.     Part.Name = "Face"
  125.     Part.FormFactor = "Custom"
  126.     Part.Size = Vector3.new(0.4, 0.2, 0.4)
  127.     Part.BrickColor = FaceColor
  128.     Part.Transparency = 0.8
  129.     Part.TopSurface = 0
  130.     Part.BottomSurface = 0
  131.     Part.Parent = Parts
  132.     Instance.new("CylinderMesh", Part).Scale = Vector3.new(1, 0.06 / 0.2, 1)
  133.     local Weld = Instance.new("Weld", Part)
  134.     Weld.Part0 = Weld.Parent
  135.     Weld.Part1 = MasterPart2
  136.     Weld.C0 = CFrame.new(0, 0.1, 0)
  137.  
  138.     local Part = Instance.new("Part")
  139.     Part.Material = "SmoothPlastic"
  140.     Part.Name = "Face Back"
  141.     Part.FormFactor = "Custom"
  142.     Part.Size = Vector3.new(0.4, 0.2, 0.4)
  143.     Part.BrickColor = FaceBackColor
  144.     Part.TopSurface = 0
  145.     Part.BottomSurface = 0
  146.     Part.Parent = Parts
  147.     Instance.new("CylinderMesh", Part).Scale = Vector3.new(1, 0.0105 / 0.2, 1)
  148.     local Weld = Instance.new("Weld", Part)
  149.     Weld.Part0 = Weld.Parent
  150.     Weld.Part1 = MasterPart2
  151.     Weld.C0 = CFrame.new(0, 0.1, 0)
  152.  
  153.     local Part = Instance.new("Part")
  154.     Part.Material = "SmoothPlastic"
  155.     Part.Name = "Hand Center"
  156.     Part.FormFactor = "Custom"
  157.     Part.Size = Vector3.new(0.2, 0.2, 0.2)
  158.     Part.BrickColor = CenterHandColor
  159.     Part.TopSurface = 0
  160.     Part.BottomSurface = 0
  161.     Part.Parent = Parts
  162.     Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.035 / 0.2, 0.04 / 0.2, 0.035 / 0.2)
  163.     local Weld = Instance.new("Weld", Part)
  164.     Weld.Part0 = Weld.Parent
  165.     Weld.Part1 = MasterPart2
  166.     Weld.C0 = CFrame.new(0, 0.1, 0)
  167.  
  168.     for i = 0, 360, 360 / 20 do
  169.         if i % (360 / 4) ~= 0 then
  170.             local Part = Instance.new("Part")
  171.             Part.Material = "SmoothPlastic"
  172.             Part.Name = "Notch 1"
  173.             Part.FormFactor = "Custom"
  174.             Part.Size = Vector3.new(0.2, 0.2, 0.2)
  175.             Part.BrickColor = NotchColor1
  176.             Part.TopSurface = 0
  177.             Part.BottomSurface = 0
  178.             Part.Parent = Parts
  179.             Instance.new("BlockMesh", Part).Scale = Vector3.new(0.01 / 0.2, 0.01075 / 0.2, 0.03 / 0.2)
  180.             local Weld = Instance.new("Weld", Part)
  181.             Weld.Part0 = Weld.Parent
  182.             Weld.Part1 = MasterPart2
  183.             Weld.C0 = CFrame.new(0, 0.1, 0.17) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0)
  184.         end
  185.     end
  186.  
  187.     for i = 0, 360, 360 / 4 do
  188.         local Part = Instance.new("Part")
  189.         Part.Material = "SmoothPlastic"
  190.         Part.Name = "Notch 2"
  191.         Part.FormFactor = "Custom"
  192.         Part.Size = Vector3.new(0.2, 0.2, 0.2)
  193.         Part.BrickColor = NotchColor2
  194.         Part.TopSurface = 0
  195.         Part.BottomSurface = 0
  196.         Part.Parent = Parts
  197.         Instance.new("BlockMesh", Part).Scale = Vector3.new(0.02 / 0.2, 0.011 / 0.2, 0.05 / 0.2)
  198.         local Weld = Instance.new("Weld", Part)
  199.         Weld.Part0 = Weld.Parent
  200.         Weld.Part1 = MasterPart2
  201.         Weld.C0 = CFrame.new(0, 0.1, 0.17) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0)
  202.     end
  203.  
  204.     local Part = Instance.new("Part")
  205.     Part.Material = "SmoothPlastic"
  206.     Part.Name = "Hand Hour"
  207.     Part.FormFactor = "Custom"
  208.     Part.Size = Vector3.new(0.2, 0.2, 0.2)
  209.     Part.BrickColor = HourHandColor
  210.     Part.TopSurface = 0
  211.     Part.BottomSurface = 0
  212.     Part.Parent = Parts
  213.     Instance.new("BlockMesh", Part).Scale = Vector3.new(0.03 / 0.2, 0.015 / 0.2, 0.1 / 0.2)
  214.     local Weld = Instance.new("Weld", Part)
  215.     Weld.Part0 = Weld.Parent
  216.     Weld.Part1 = MasterPart2
  217.     Weld.C0 = CFrame.new(0, 0.11, 0.05)
  218.  
  219.     local Part = Instance.new("Part")
  220.     Part.Material = "SmoothPlastic"
  221.     Part.Name = "Hand Minute"
  222.     Part.FormFactor = "Custom"
  223.     Part.Size = Vector3.new(0.2, 0.2, 0.2)
  224.     Part.BrickColor = MinuteHandColor
  225.     Part.TopSurface = 0
  226.     Part.BottomSurface = 0
  227.     Part.Parent = Parts
  228.     Instance.new("BlockMesh", Part).Scale = Vector3.new(0.02 / 0.2, 0.0125 / 0.2, 0.15 / 0.2)
  229.     local Weld = Instance.new("Weld", Part)
  230.     Weld.Part0 = Weld.Parent
  231.     Weld.Part1 = MasterPart2
  232.     Weld.C0 = CFrame.new(0, 0.11, 0.075)
  233.  
  234.     local Part = Instance.new("Part")
  235.     Part.Material = "SmoothPlastic"
  236.     Part.Name = "Hand Second"
  237.     Part.FormFactor = "Custom"
  238.     Part.Size = Vector3.new(0.2, 0.2, 0.2)
  239.     Part.BrickColor = SecondHandColor
  240.     Part.TopSurface = 0
  241.     Part.BottomSurface = 0
  242.     Part.Parent = Parts
  243.     Instance.new("BlockMesh", Part).Scale = Vector3.new(0.01 / 0.2, 0.01 / 0.2, 0.17 / 0.2)
  244.     local Weld = Instance.new("Weld", Part)
  245.     Weld.Part0 = Weld.Parent
  246.     Weld.Part1 = MasterPart2
  247.     Weld.C0 = CFrame.new(0, 0.11, 0.085)
  248.  
  249.     for _, Part in pairs(Parts:GetChildren()) do
  250.         Part.Locked = true
  251.         Part.CanCollide = false
  252.     end
  253.  
  254.     coroutine.wrap(function()
  255.         while Parts.Parent ~= nil do
  256.             local Hours, Minutes, Seconds = Time()
  257.             --SoundToServer("Tick", "http://www.roblox.com/Asset/?id=14863866", 5, 0.5, false, Parts:FindFirstChild("Watch"))
  258.             pcall(function() Parts["Hand Hour"].Weld.C1 = CFrame.fromEulerAnglesXYZ(0, (math.pi * (Hours / 12) * 2) - math.rad(90), 0) end)
  259.             pcall(function() Parts["Hand Minute"].Weld.C1 = CFrame.fromEulerAnglesXYZ(0, (math.pi * (Minutes / 60) * 2) - math.rad(90), 0) end)
  260.             pcall(function() Parts["Hand Second"].Weld.C1 = CFrame.fromEulerAnglesXYZ(0, (math.pi * (Seconds / 60) * 2) - math.rad(90), 0) end)
  261.             wait(1)
  262.         end
  263.     end)()
  264. end
  265.  
  266.  
  267. function RemoveParts(Parent, Format)
  268.     if Format == 1 then
  269.         pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  270.     elseif Format == 2 then
  271.         pcall(function() Parent[ModelName]:Remove() end)
  272.     end
  273. end
  274.  
  275.  
  276. function SetAngle(Joint, Angle, Character)
  277.     if Character == nil then return false end
  278.     local Joints = {
  279.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  280.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  281.         Character.Torso:FindFirstChild("Right Hip 2"),
  282.         Character.Torso:FindFirstChild("Left Hip 2")
  283.     }
  284.     if Joints[Joint] == nil then return false end
  285.     if Joint == 1 or Joint == 3 then
  286.         Joints[Joint].DesiredAngle = Angle
  287.     end
  288.     if Joint == 2 or Joint == 4 then
  289.         Joints[Joint].DesiredAngle = -Angle
  290.     end
  291. end
  292.  
  293.  
  294. function ForceAngle(Joint, Angle, Character)
  295.     if Character == nil then return false end
  296.     local Joints = {
  297.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  298.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  299.         Character.Torso:FindFirstChild("Right Hip 2"),
  300.         Character.Torso:FindFirstChild("Left Hip 2")
  301.     }
  302.     if Joints[Joint] == nil then return false end
  303.     if Joint == 1 or Joint == 3 then
  304.         Joints[Joint].DesiredAngle = Angle
  305.         Joints[Joint].CurrentAngle = Angle
  306.     end
  307.     if Joint == 2 or Joint == 4 then
  308.         Joints[Joint].DesiredAngle = -Angle
  309.         Joints[Joint].CurrentAngle = -Angle
  310.     end
  311. end
  312.  
  313.  
  314. function SetSpeed(Joint, Speed, Character)
  315.     if Character == nil then return false end
  316.     local Joints = {
  317.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  318.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  319.         Character.Torso:FindFirstChild("Right Hip 2"),
  320.         Character.Torso:FindFirstChild("Left Hip 2")
  321.     }
  322.     if Joints[Joint] == nil then return false end
  323.     Joints[Joint].MaxVelocity = Speed
  324. end
  325.  
  326.  
  327. function DisableLimb(Limb, Character)
  328.     if Character == nil then return false end
  329.     if Character:FindFirstChild("Torso") == nil then return false end
  330.     local Joints = {
  331.         Character.Torso:FindFirstChild("Right Shoulder"),
  332.         Character.Torso:FindFirstChild("Left Shoulder"),
  333.         Character.Torso:FindFirstChild("Right Hip"),
  334.         Character.Torso:FindFirstChild("Left Hip")
  335.     }
  336.     local Limbs = {
  337.         Character:FindFirstChild("Right Arm"),
  338.         Character:FindFirstChild("Left Arm"),
  339.         Character:FindFirstChild("Right Leg"),
  340.         Character:FindFirstChild("Left Leg")
  341.     }
  342.     if Joints[Limb] == nil then return false end
  343.     if Limbs[Limb] == nil then return false end
  344.     local Joint = Instance.new("Motor6D")
  345.     Joint.Parent = Character.Torso
  346.     Joint.Part0 = Character.Torso
  347.     Joint.Part1 = Limbs[Limb]
  348.     if Limb == 1 then
  349.         Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  350.         Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  351.         Joint.Name = "Right Shoulder 2"
  352.     elseif Limb == 2 then
  353.         Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  354.         Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  355.         Joint.Name = "Left Shoulder 2"
  356.     elseif Limb == 3 then
  357.         Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  358.         Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  359.         Joint.Name = "Right Hip 2"
  360.     elseif Limb == 4 then
  361.         Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  362.         Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  363.         Joint.Name = "Left Hip 2"
  364.     end
  365.     Joint.MaxVelocity = Joints[Limb].MaxVelocity
  366.     Joint.CurrentAngle = Joints[Limb].CurrentAngle
  367.     Joint.DesiredAngle = Joints[Limb].DesiredAngle
  368.     Joints[Limb]:Remove()
  369. end
  370.  
  371.  
  372. function ResetLimbCFrame(Limb, Character)
  373.     if Character == nil then return false end
  374.     if Character.Parent == nil then return false end
  375.     if Character:FindFirstChild("Torso") == nil then return false end
  376.     local Joints = {
  377.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  378.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  379.         Character.Torso:FindFirstChild("Right Hip 2"),
  380.         Character.Torso:FindFirstChild("Left Hip 2")
  381.     }
  382.     local Limbs = {
  383.         Character:FindFirstChild("Right Arm"),
  384.         Character:FindFirstChild("Left Arm"),
  385.         Character:FindFirstChild("Right Leg"),
  386.         Character:FindFirstChild("Left Leg")
  387.     }
  388.     if Joints[Limb] == nil then return false end
  389.     if Limbs[Limb] == nil then return false end
  390.     if Limb == 1 then
  391.         Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  392.         Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  393.     elseif Limb == 2 then
  394.         Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  395.         Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  396.     elseif Limb == 3 then
  397.         Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  398.         Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  399.     elseif Limb == 4 then
  400.         Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  401.         Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  402.     end
  403. end
  404.  
  405.  
  406. function EnableLimb(Limb, Character)
  407.     if Character == nil then return false end
  408.     if Character:FindFirstChild("Torso") == nil then return false end
  409.     local Joints = {
  410.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  411.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  412.         Character.Torso:FindFirstChild("Right Hip 2"),
  413.         Character.Torso:FindFirstChild("Left Hip 2")
  414.     }
  415.     local Limbs = {
  416.         Character:FindFirstChild("Right Arm"),
  417.         Character:FindFirstChild("Left Arm"),
  418.         Character:FindFirstChild("Right Leg"),
  419.         Character:FindFirstChild("Left Leg")
  420.     }
  421.     if Joints[Limb] == nil then return false end
  422.     if Limbs[Limb] == nil then return false end
  423.     if Limb == 1 then
  424.         Joints[Limb].Name = "Right Shoulder"
  425.     elseif Limb == 2 then
  426.         Joints[Limb].Name = "Left Shoulder"
  427.     elseif Limb == 3 then
  428.         Joints[Limb].Name = "Right Hip"
  429.     elseif Limb == 4 then
  430.         Joints[Limb].Name = "Left Hip"
  431.     end
  432.     Animate = Character:FindFirstChild("Animate")
  433.     if Animate == nil then return false end
  434.     Animate = Animate:Clone()
  435.     Character.Animate:Remove()
  436.     Animate.Parent = Character
  437. end
  438.  
  439.  
  440. function onButton1Down(Mouse)
  441.     if Button1Down == true then return end
  442.     Button1Down = true
  443.     if CheckPlayer() == false then return end
  444.     if CanUse == true then
  445.         CanUse = false
  446.         DisableLimb(1, Player.Character)
  447.         SetSpeed(1, 0.5, Player.Character)
  448.         SetAngle(1, 0, Player.Character)
  449.         RemoveParts(Player.Character, 1)
  450.         CreateParts(Player.Character, 2)
  451.         wait(0.2)
  452.         for i = 0, 1, 0.075 do
  453.             pcall(function()
  454.                 Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - (40 * i)), math.rad(-5 * i), math.rad(180 - (15 * i)))
  455.                 Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - (0.15 * i), 0.5, -0.2 * i) * CFrame.fromEulerAnglesXYZ(math.rad(100 * i), math.rad(90 + (130 * i)), math.rad(40 * i))
  456.             end)
  457.             wait()
  458.         end
  459.         pcall(function()
  460.             Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-130), math.rad(-5), math.rad(165))
  461.             Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.35, 0.5, -0.2) * CFrame.fromEulerAnglesXYZ(math.rad(100), math.rad(220), math.rad(40))
  462.         end)
  463.         wait(0.1)
  464.         CanUse = true
  465.         coroutine.wrap(function()
  466.             while Selected == true and Button1Down == true do
  467.                 wait()
  468.             end
  469.             CanUse = false
  470.             for i = 1, 0, -0.075 do
  471.                 pcall(function()
  472.                     Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - (40 * i)), math.rad(-5 * i), math.rad(180 - (15 * i)))
  473.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - (0.15 * i), 0.5, -0.2 * i) * CFrame.fromEulerAnglesXYZ(math.rad(100 * i), math.rad(90 + (130 * i)), math.rad(40 * i))
  474.                 end)
  475.                 wait()
  476.             end
  477.             pcall(function()
  478.                 Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(180))
  479.             end)
  480.             ResetLimbCFrame(1, Player.Character)
  481.             EnableLimb(1, Player.Character)
  482.             RemoveParts(Player.Character, 2)
  483.             CreateParts(Player.Character, 1)
  484.             CanUse = true
  485.         end)()
  486.     end
  487. end
  488.  
  489.  
  490. function onButton1Up(Mouse)
  491.     Button1Down = false
  492. end
  493.  
  494.  
  495. function onKeyDown(Key, Mouse)
  496.     if Selected == false then return end
  497.     Key = Key:lower()
  498.     if Button1Down == false and CanUse == true and CheckPlayer() == true then
  499.         if Key == "q" then
  500.             if Mouse.Target == nil then return end
  501.             if CheckPlayer() == false then return end
  502.             local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  503.             if NewPlayer == nil then return end
  504.             if NewPlayer.Character == nil then return end
  505.             if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  506.             if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  507.             onDeselected(Mouse)
  508.             wait()
  509.             RemoveParts(Player.Character, 1)
  510.             script.Parent.Parent = NewPlayer.Backpack
  511.             Player = NewPlayer
  512.         end
  513.     end
  514. end
  515.  
  516.  
  517. function onSelected(Mouse)
  518.     if Selected == true or CanUse == false then return end
  519.     CanUse = false
  520.     while true do
  521.         if CheckPlayer() == true then
  522.             if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil then
  523.                 break
  524.             end
  525.         end
  526.         wait(0.1)
  527.     end
  528.     Selected = true
  529.     Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  530.     Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  531.     Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  532.     Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  533.     CanUse = true
  534. end
  535.  
  536.  
  537. function onDeselected(Mouse)
  538.     if Selected == false then return end
  539.     Selected = false
  540. end
  541.  
  542.  
  543. if script.Parent.ClassName ~= "HopperBin" then
  544.     if Player == nil then print("Error: Player not found!") return end
  545.     Tool = Instance.new("HopperBin")
  546.     Tool.Name = ModelName
  547.     Tool.Parent = Player.Backpack
  548.     script.Name = "Main"
  549.     script.Parent = Tool
  550. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  551.     Connected = true
  552.     Player = script.Parent.Parent.Parent
  553.     end wait() if script.Parent.ClassName == "HopperBin" then
  554.     while script.Parent.Parent.ClassName ~= "Backpack" do
  555.         wait()
  556.     end
  557.     script.Parent.Selected:connect(onSelected)
  558.     script.Parent.Deselected:connect(onDeselected)
  559.     CreateParts(Player.Character, 1)
  560.  
  561. end
Add Comment
Please, Sign In to add comment