Advertisement
Oscar55555

Untitled

Feb 20th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.95 KB | None | 0 0
  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
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152. --[[
  153. Poison Syringe
  154.  
  155. Syringe filled with a deadly poison that slowly kills its' host.
  156. Script by DarkShadow6
  157. --]]
  158.  
  159.  
  160. if script == nil then return end
  161.  
  162.  
  163. Player = game:GetService("Players"):FindFirstChild("myalt1562")
  164. Name = "Poison Syringe"
  165. selected = false
  166. Button1Down = false
  167. CanUse = true
  168.  
  169.  
  170. function makeParts(format)
  171. local model = Instance.new("Model")
  172. model.Name = Name
  173. local pm = Instance.new("Part")
  174. pm.Name = "Handle"
  175. pm.FormFactor = "Custom"
  176. pm.Size = Vector3.new(1, 1, 1)
  177. pm.BrickColor = BrickColor.new("Institutional white")
  178. pm.Locked = true
  179. pm.TopSurface = 0
  180. pm.BottomSurface = 0
  181. pm.Parent = model
  182. local m = Instance.new("CylinderMesh")
  183. m.Scale = Vector3.new(0.25, 1, 0.25)
  184. m.Parent = pm
  185. if format ~= nil then
  186. local w = Instance.new("Weld")
  187. w.Part0 = pm
  188. if format == "hand" then
  189. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  190. w.C0 = CFrame.new(0, 0.1, 1.1) * CFrame.fromEulerAnglesXYZ(math.rad(70), 0, 0)
  191. w.C1 = CFrame.new()
  192. elseif format == "holster" then
  193. w.Part1 = Player.Character:FindFirstChild("Right Leg")
  194. w.C0 = CFrame.new(-0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  195. w.C1 = CFrame.new()
  196. w.Parent = pm
  197. model.Name = Name.. " (Holstered)"
  198. end
  199. w.Parent = pm
  200. model.Parent = Player.Character
  201. end
  202. local p = Instance.new("Part")
  203. p.Name = "Syringe Valve 1"
  204. p.FormFactor = "Custom"
  205. p.Size = Vector3.new(1, 1, 1)
  206. p.BrickColor = BrickColor.new("Institutional white")
  207. p.CanCollide = false
  208. p.Locked = true
  209. p.TopSurface = 0
  210. p.BottomSurface = 0
  211. p.Parent = model
  212. local m = Instance.new("CylinderMesh")
  213. m.Scale = Vector3.new(0.15, 0.5, 0.15)
  214. m.Parent = p
  215. local w = Instance.new("Weld")
  216. w.Part0 = p
  217. w.Part1 = pm
  218. w.C0 = CFrame.new(0, -0.75, 0)
  219. w.C1 = CFrame.new()
  220. w.Parent = p
  221. local p = Instance.new("Part")
  222. p.Name = "Syringe Valve 2"
  223. p.FormFactor = "Custom"
  224. p.Size = Vector3.new(1, 1, 1)
  225. p.BrickColor = BrickColor.new("Institutional white")
  226. p.CanCollide = false
  227. p.Locked = true
  228. p.TopSurface = 0
  229. p.BottomSurface = 0
  230. p.Parent = model
  231. local m = Instance.new("CylinderMesh")
  232. m.Scale = Vector3.new(0.3, 0.01, 0.3)
  233. m.Parent = p
  234. local w = Instance.new("Weld")
  235. w.Part0 = p
  236. w.Part1 = pm
  237. w.C0 = CFrame.new(0, -1, 0)
  238. w.C1 = CFrame.new()
  239. w.Parent = p
  240. local p = Instance.new("Part")
  241. p.Name = "Syringe Tip"
  242. p.FormFactor = "Custom"
  243. p.Size = Vector3.new(1, 1, 1)
  244. p.BrickColor = BrickColor.new("Institutional white")
  245. p.CanCollide = false
  246. p.Locked = true
  247. p.TopSurface = 0
  248. p.BottomSurface = 0
  249. p.Parent = model
  250. local m = Instance.new("CylinderMesh")
  251. m.Scale = Vector3.new(0.2, 0.1, 0.2)
  252. m.Parent = p
  253. local w = Instance.new("Weld")
  254. w.Part0 = p
  255. w.Part1 = pm
  256. w.C0 = CFrame.new(0, 0.5, 0)
  257. w.C1 = CFrame.new()
  258. w.Parent = p
  259. local p = Instance.new("Part")
  260. p.Name = "Syringe Needle"
  261. p.FormFactor = "Custom"
  262. p.Size = Vector3.new(1, 1, 1)
  263. p.BrickColor = BrickColor.new("Medium stone grey")
  264. p.CanCollide = false
  265. p.Locked = true
  266. p.TopSurface = 0
  267. p.BottomSurface = 0
  268. p.Parent = model
  269. local m = Instance.new("CylinderMesh")
  270. m.Scale = Vector3.new(0.01, 1, 0.01)
  271. m.Parent = p
  272. local w = Instance.new("Weld")
  273. w.Part0 = p
  274. w.Part1 = pm
  275. w.C0 = CFrame.new(0, 1, 0)
  276. w.C1 = CFrame.new()
  277. w.Parent = p
  278. return model
  279. end
  280.  
  281.  
  282. function removeParts(format)
  283. if format == "hand" then
  284. pcall(function() Player.Character[Name]:Remove() end)
  285. elseif format == "holster" then
  286. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  287. end
  288. end
  289.  
  290.  
  291. function SetAngle(Joint, Angle, Character)
  292. if Character == nil then return false end
  293. local Joints = {
  294. Character.Torso:FindFirstChild("Right Shoulder 2"),
  295. Character.Torso:FindFirstChild("Left Shoulder 2"),
  296. Character.Torso:FindFirstChild("Right Hip 2"),
  297. Character.Torso:FindFirstChild("Left Hip 2")
  298. }
  299. if Joints[Joint] == nil then return false end
  300. if Joint == 1 or Joint == 3 then
  301. Joints[Joint].DesiredAngle = Angle
  302. end
  303. if Joint == 2 or Joint == 4 then
  304. Joints[Joint].DesiredAngle = -Angle
  305. end
  306. end
  307.  
  308.  
  309. function ForceAngle(Joint, Angle, Character)
  310. if Character == nil then return false end
  311. local Joints = {
  312. Character.Torso:FindFirstChild("Right Shoulder 2"),
  313. Character.Torso:FindFirstChild("Left Shoulder 2"),
  314. Character.Torso:FindFirstChild("Right Hip 2"),
  315. Character.Torso:FindFirstChild("Left Hip 2")
  316. }
  317. if Joints[Joint] == nil then return false end
  318. if Joint == 1 or Joint == 3 then
  319. Joints[Joint].DesiredAngle = Angle
  320. Joints[Joint].CurrentAngle = Angle
  321. end
  322. if Joint == 2 or Joint == 4 then
  323. Joints[Joint].DesiredAngle = -Angle
  324. Joints[Joint].CurrentAngle = -Angle
  325. end
  326. end
  327.  
  328.  
  329. function SetSpeed(Joint, Speed, Character)
  330. if Character == nil then return false end
  331. local Joints = {
  332. Character.Torso:FindFirstChild("Right Shoulder 2"),
  333. Character.Torso:FindFirstChild("Left Shoulder 2"),
  334. Character.Torso:FindFirstChild("Right Hip 2"),
  335. Character.Torso:FindFirstChild("Left Hip 2")
  336. }
  337. if Joints[Joint] == nil then return false end
  338. Joints[Joint].MaxVelocity = Speed
  339. end
  340.  
  341.  
  342. function DisableLimb(Limb, Character)
  343. if Character == nil then return false end
  344. if Character:FindFirstChild("Torso") == nil then return false end
  345. local Joints = {
  346. Character.Torso:FindFirstChild("Right Shoulder"),
  347. Character.Torso:FindFirstChild("Left Shoulder"),
  348. Character.Torso:FindFirstChild("Right Hip"),
  349. Character.Torso:FindFirstChild("Left Hip")
  350. }
  351. local Limbs = {
  352. Character:FindFirstChild("Right Arm"),
  353. Character:FindFirstChild("Left Arm"),
  354. Character:FindFirstChild("Right Leg"),
  355. Character:FindFirstChild("Left Leg")
  356. }
  357. if Joints[Limb] == nil then return false end
  358. if Limbs[Limb] == nil then return false end
  359. local Joint = Instance.new("Motor")
  360. Joint.Parent = Character.Torso
  361. Joint.Part0 = Character.Torso
  362. Joint.Part1 = Limbs[Limb]
  363. if Limb == 1 then
  364. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  365. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  366. Joint.Name = "Right Shoulder 2"
  367. elseif Limb == 2 then
  368. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  369. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  370. Joint.Name = "Left Shoulder 2"
  371. elseif Limb == 3 then
  372. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  373. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  374. Joint.Name = "Right Hip 2"
  375. elseif Limb == 4 then
  376. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  377. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  378. Joint.Name = "Left Hip 2"
  379. end
  380. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  381. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  382. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  383. Joints[Limb]:Remove()
  384. end
  385.  
  386.  
  387. function ResetLimbCFrame(Limb, Character)
  388. if Character == nil then return false end
  389. if Character.Parent == nil then return false end
  390. if Character:FindFirstChild("Torso") == nil then return false end
  391. local Joints = {
  392. Character.Torso:FindFirstChild("Right Shoulder 2"),
  393. Character.Torso:FindFirstChild("Left Shoulder 2"),
  394. Character.Torso:FindFirstChild("Right Hip 2"),
  395. Character.Torso:FindFirstChild("Left Hip 2")
  396. }
  397. local Limbs = {
  398. Character:FindFirstChild("Right Arm"),
  399. Character:FindFirstChild("Left Arm"),
  400. Character:FindFirstChild("Right Leg"),
  401. Character:FindFirstChild("Left Leg")
  402. }
  403. if Joints[Limb] == nil then return false end
  404. if Limbs[Limb] == nil then return false end
  405. if Limb == 1 then
  406. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  407. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  408. elseif Limb == 2 then
  409. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  410. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  411. elseif Limb == 3 then
  412. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  413. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  414. elseif Limb == 4 then
  415. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  416. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  417. end
  418. end
  419.  
  420.  
  421. function EnableLimb(Limb, Character)
  422. if Character == nil then return false end
  423. if Character:FindFirstChild("Torso") == nil then return false end
  424. local Joints = {
  425. Character.Torso:FindFirstChild("Right Shoulder 2"),
  426. Character.Torso:FindFirstChild("Left Shoulder 2"),
  427. Character.Torso:FindFirstChild("Right Hip 2"),
  428. Character.Torso:FindFirstChild("Left Hip 2")
  429. }
  430. local Limbs = {
  431. Character:FindFirstChild("Right Arm"),
  432. Character:FindFirstChild("Left Arm"),
  433. Character:FindFirstChild("Right Leg"),
  434. Character:FindFirstChild("Left Leg")
  435. }
  436. if Joints[Limb] == nil then return false end
  437. if Limbs[Limb] == nil then return false end
  438. if Limb == 1 then
  439. Joints[Limb].Name = "Right Shoulder"
  440. elseif Limb == 2 then
  441. Joints[Limb].Name = "Left Shoulder"
  442. elseif Limb == 3 then
  443. Joints[Limb].Name = "Right Hip"
  444. elseif Limb == 4 then
  445. Joints[Limb].Name = "Left Hip"
  446. end
  447. Animate = Character:FindFirstChild("Animate")
  448. if Animate == nil then return false end
  449. Animate = Animate:Clone()
  450. Character.Animate:Remove()
  451. Animate.Parent = Character
  452. end
  453.  
  454.  
  455. function onButton1Down(mouse)
  456. if selected == false or CanUse == false then return end
  457. if Player.Character:FindFirstChild(Name) ~= nil then
  458. local Model = nil
  459. if mouse.Target ~= nil then
  460. if mouse.Target.Parent:FindFirstChild("Humanoid") ~= nil and mouse.Target.Parent:FindFirstChild("Torso") ~= nil then
  461. Model = mouse.Target.Parent
  462. if (Model.Torso.Position - Player.Character[Name]["Syringe Needle"].Position).magnitude > 3 then return end
  463. end
  464. end
  465. if Model == nil then
  466. if Player.Character:FindFirstChild("Humanoid") ~= nil and Player.Character:FindFirstChild("Torso") ~= nil then
  467. Model = Player.Character
  468. end
  469. end
  470. if Model == nil then return end
  471. if Model:FindFirstChild("IsPoisoned") ~= nil then return end
  472. CanUse = false
  473. coroutine.wrap(function()
  474. Instance.new("Model", Model).Name = "IsPoisoned"
  475. for i = Model.Humanoid.Health, Model.Humanoid.MaxHealth, 5 do
  476. Model.Humanoid.Health = i
  477. wait()
  478. end
  479. Model.Humanoid.Health = Model.Humanoid.MaxHealth
  480. wait(1)
  481. local Player2 = game:GetService("Players"):GetPlayerFromCharacter(Model)
  482. if Player2 ~= nil then
  483. if Player2:FindFirstChild("PlayerGui") ~= nil then
  484. local Gui = Instance.new("ScreenGui")
  485. Gui.Name = "Poison"
  486. Gui.Parent = Player2.PlayerGui
  487. local Frame = Instance.new("Frame")
  488. Frame.Name = "Black"
  489. Frame.Size = UDim2.new(2, 0, 2, 0)
  490. Frame.Position = UDim2.new(-0.5, 0, -0.5, 0)
  491. Frame.BackgroundColor3 = Color3.new(0.05, 0, 0.1)
  492. Frame.BackgroundTransparency = 0
  493. Frame.Parent = Gui
  494. Gui.Parent = Player2.PlayerGui
  495. end
  496. end
  497. while Model.Humanoid.Health > 1 and Model:FindFirstChild("IsPoisoned") ~= nil do
  498. Model.Humanoid.Health = Model.Humanoid.Health - 0.25
  499. pcall(function() Player2.PlayerGui.Poison.Black.BackgroundTransparency = Model.Humanoid.Health / Model.Humanoid.MaxHealth end)
  500. Model.Humanoid.WalkSpeed = (Model.Humanoid.Health / Model.Humanoid.MaxHealth) * 16
  501. wait()
  502. end
  503. if Model:FindFirstChild("IsPoisoned") ~= nil then
  504. Model.Humanoid.Health = 0
  505. else
  506. for i = Player2.PlayerGui.Poison.Black.BackgroundTransparency, 1, 0.05 do
  507. pcall(function() Player2.PlayerGui.Poison.Black.BackgroundTransparency = i end)
  508. wait()
  509. end
  510. pcall(function() Player2.PlayerGui.Poison:Remove() end)
  511. end
  512. end)()
  513. if Model == Player.Character then
  514. SetSpeed(1, 0.1, Model)
  515. for i = 90, 0, -10 do
  516. SetAngle(1, math.rad(5), Model)
  517. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0)
  518. wait()
  519. end
  520. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0)
  521. end
  522. coroutine.wrap(function()
  523. for i = 0, 1, 0.1 do
  524. Player.Character[Name]["Syringe Valve 1"].Weld.C0 = CFrame.new(0, -0.75 + (0.5 * i), 0)
  525. Player.Character[Name]["Syringe Valve 2"].Weld.C0 = CFrame.new(0, -1 + (0.5 * i), 0)
  526. wait()
  527. end
  528. wait(0.25)
  529. for i = 1, 0, -0.05 do
  530. Player.Character[Name]["Syringe Valve 1"].Weld.C0 = CFrame.new(0, -0.75 + (0.5 * i), 0)
  531. Player.Character[Name]["Syringe Valve 2"].Weld.C0 = CFrame.new(0, -1 + (0.5 * i), 0)
  532. wait()
  533. end
  534. end)()
  535. if Model == Player.Character then
  536. wait(0.75)
  537. SetSpeed(1, 0.1, Model)
  538. for i = 0, 90, 15 do
  539. SetAngle(1, math.rad(90), Model)
  540. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0)
  541. wait()
  542. end
  543. ResetLimbCFrame(1, Model)
  544. end
  545. CanUse = true
  546. end
  547. end
  548.  
  549.  
  550. function onKeyDown(key, mouse)
  551. if selected == false then return end
  552. key = key:lower()
  553. if key == "q" and CanUse == true then
  554. if mouse.Target == nil then return end
  555. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  556. onDeselected(mouse)
  557. removeParts("holster")
  558. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  559. end
  560. end
  561. end
  562.  
  563.  
  564. function onSelected(mouse)
  565. if selected == true then return end
  566. selected = true
  567. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  568. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  569. if Player.Character.WeaponActivated.Value == nil then break end
  570. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  571. wait()
  572. end
  573. local weapon = Instance.new("ObjectValue")
  574. weapon.Name = "WeaponActivated"
  575. weapon.Value = script.Parent
  576. weapon.Parent = Player.Character
  577. DisableLimb(1, Player.Character)
  578. SetAngle(1, math.rad(90), Player.Character)
  579. removeParts("holster")
  580. makeParts("hand")
  581. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  582. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  583. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  584. end
  585.  
  586.  
  587. function onDeselected(mouse)
  588. if selected == false then return end
  589. Button1Down = false
  590. while canFire == false do
  591. wait()
  592. end
  593. selected = false
  594. removeParts("hand")
  595. makeParts("holster")
  596. ForceAngle(1, 0, Player.Character)
  597. EnableLimb(1, Player.Character)
  598. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  599. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  600. if Player.Character.WeaponActivated.Value == script.Parent then
  601. Player.Character.WeaponActivated:Remove()
  602. end
  603. end
  604. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  605. if Player.Character.WeaponActivated.Value == nil then break end
  606. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  607. wait()
  608. end
  609. end
  610.  
  611.  
  612. if script.Parent.ClassName ~= "HopperBin" then
  613. if Player == nil then print("Error: Player not found!") return end
  614. Tool = Instance.new("HopperBin")
  615. Tool.Name = Name
  616. Tool.Parent = Player.Backpack
  617. script.Name = "Main"
  618. script.Parent = Tool
  619. elseif script.Parent.ClassName == "HopperBin" then
  620. while script.Parent.Parent.ClassName ~= "Backpack" do
  621. wait()
  622. end
  623. Player = script.Parent.Parent.Parent
  624. makeParts("holster")
  625. script.Parent.Selected:connect(onSelected)
  626. script.Parent.Deselected:connect(onDeselected)
  627. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement