Advertisement
lafur

Untitled

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