Advertisement
voidscriptbuilderr

Untitled

Jul 11th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.09 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 Talon")
  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. Script Version 1
  154.  
  155. CocaCola on steroids!
  156.  
  157. Script by DarkShadow6
  158. --]]
  159.  
  160.  
  161. if script == nil then return end
  162.  
  163.  
  164. Player = game.Players:FindFirstChild("zombieslayerwtf")
  165. Name = "Pepsi"
  166. selected = false
  167. Button1Down = false
  168. canUse = true
  169.  
  170.  
  171. function makeParts(format)
  172. local bottle = Instance.new("Model")
  173. bottle.Name = Name
  174. bottle.Parent = Player.Character
  175. local pm = Instance.new("Part")
  176. pm.Name = "Handle"
  177. pm.FormFactor = "Custom"
  178. pm.Size = Vector3.new(1, 1, 1)
  179. pm.BrickColor = BrickColor.new("Medium stone grey")
  180. pm.Reflectance = 0.2
  181. pm.Locked = true
  182. pm.TopSurface = 0
  183. pm.BottomSurface = 0
  184. pm.Parent = bottle
  185. local m = Instance.new("CylinderMesh")
  186. m.Scale = Vector3.new(0.8, 1.1, 0.8)
  187. m.Parent = pm
  188. local d = Instance.new("Decal")
  189. d.Texture = "http://www.roblox.com/Asset/?id=34399263"
  190. d.Parent = pm
  191. local w = Instance.new("Weld")
  192. w.Part0 = pm
  193. if format == "hand" then
  194. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  195. w.C0 = CFrame.new(0, 0, 1.2) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  196. w.C1 = CFrame.new()
  197. d.Face = "Front"
  198. elseif format == "holster" then
  199. w.Part1 = Player.Character:FindFirstChild("Left Leg")
  200. w.C0 = CFrame.new(0, -0.4, -0.5)
  201. w.C1 = CFrame.new()
  202. d.Face = "Back"
  203. bottle.Name = Name.. " (Holstered)"
  204. end
  205. w.Parent = pm
  206. local s = Instance.new("Sound")
  207. s.Name = "Drink"
  208. s.SoundId = "http://www.roblox.com/Asset/?id=10722059"
  209. s.Volume = 1
  210. s.Pitch = 1
  211. s.Looped = false
  212. s.Parent = pm
  213. local s = Instance.new("Sound")
  214. s.Name = "Open"
  215. s.SoundId = "http://www.roblox.com/Asset/?id=10721950"
  216. s.Volume = 1
  217. s.Pitch = 1.5
  218. s.Looped = false
  219. s.Parent = pm
  220. local s = Instance.new("Sound")
  221. s.Name = "Throw"
  222. s.SoundId = "http://www.roblox.com/Asset/?id=18426149"
  223. s.Volume = 1
  224. s.Pitch = 1
  225. s.Looped = false
  226. s.Parent = pm
  227. end
  228.  
  229.  
  230. function removeParts(format)
  231. if format == "hand" then
  232. if Player.Character:FindFirstChild(Name) ~= nil then
  233. Player.Character[Name]:Remove()
  234. end
  235. elseif format == "holster" then
  236. if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then
  237. Player.Character[Name.. " (Holstered)"]:Remove()
  238. end
  239. end
  240. end
  241.  
  242.  
  243. function SetAngle(Joint, Angle, Character)
  244. if Character == nil then return false end
  245. local Joints = {
  246. Character.Torso:FindFirstChild("Right Shoulder 2"),
  247. Character.Torso:FindFirstChild("Left Shoulder 2"),
  248. Character.Torso:FindFirstChild("Right Hip 2"),
  249. Character.Torso:FindFirstChild("Left Hip 2")
  250. }
  251. if Joints[Joint] == nil then return false end
  252. if Joint == 1 or Joint == 3 then
  253. Joints[Joint].DesiredAngle = Angle
  254. end
  255. if Joint == 2 or Joint == 4 then
  256. Joints[Joint].DesiredAngle = -Angle
  257. end
  258. end
  259.  
  260.  
  261. function ForceAngle(Joint, Angle, Character)
  262. if Character == nil then return false end
  263. local Joints = {
  264. Character.Torso:FindFirstChild("Right Shoulder 2"),
  265. Character.Torso:FindFirstChild("Left Shoulder 2"),
  266. Character.Torso:FindFirstChild("Right Hip 2"),
  267. Character.Torso:FindFirstChild("Left Hip 2")
  268. }
  269. if Joints[Joint] == nil then return false end
  270. if Joint == 1 or Joint == 3 then
  271. Joints[Joint].DesiredAngle = Angle
  272. Joints[Joint].CurrentAngle = Angle
  273. end
  274. if Joint == 2 or Joint == 4 then
  275. Joints[Joint].DesiredAngle = -Angle
  276. Joints[Joint].CurrentAngle = -Angle
  277. end
  278. end
  279.  
  280.  
  281. function SetSpeed(Joint, Speed, Character)
  282. if Character == nil then return false end
  283. local Joints = {
  284. Character.Torso:FindFirstChild("Right Shoulder 2"),
  285. Character.Torso:FindFirstChild("Left Shoulder 2"),
  286. Character.Torso:FindFirstChild("Right Hip 2"),
  287. Character.Torso:FindFirstChild("Left Hip 2")
  288. }
  289. if Joints[Joint] == nil then return false end
  290. Joints[Joint].MaxVelocity = Speed
  291. end
  292.  
  293.  
  294. function DisableLimb(Limb, Character)
  295. if Character == nil then return false end
  296. if Character:FindFirstChild("Torso") == nil then return false end
  297. local Joints = {
  298. Character.Torso:FindFirstChild("Right Shoulder"),
  299. Character.Torso:FindFirstChild("Left Shoulder"),
  300. Character.Torso:FindFirstChild("Right Hip"),
  301. Character.Torso:FindFirstChild("Left Hip")
  302. }
  303. local Limbs = {
  304. Character:FindFirstChild("Right Arm"),
  305. Character:FindFirstChild("Left Arm"),
  306. Character:FindFirstChild("Right Leg"),
  307. Character:FindFirstChild("Left Leg")
  308. }
  309. if Joints[Limb] == nil then return false end
  310. if Limbs[Limb] == nil then return false end
  311. local Joint = Instance.new("Motor")
  312. Joint.Parent = Character.Torso
  313. Joint.Part0 = Character.Torso
  314. Joint.Part1 = Limbs[Limb]
  315. if Limb == 1 then
  316. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  317. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  318. Joint.Name = "Right Shoulder 2"
  319. elseif Limb == 2 then
  320. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  321. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  322. Joint.Name = "Left Shoulder 2"
  323. elseif Limb == 3 then
  324. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  325. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  326. Joint.Name = "Right Hip 2"
  327. elseif Limb == 4 then
  328. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  329. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  330. Joint.Name = "Left Hip 2"
  331. end
  332. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  333. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  334. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  335. Joints[Limb]:Remove()
  336. end
  337.  
  338.  
  339. function ResetLimbCFrame(Limb, Character)
  340. if Character == nil then return false end
  341. if Character.Parent == nil then return false end
  342. if Character:FindFirstChild("Torso") == nil then return false end
  343. local Joints = {
  344. Character.Torso:FindFirstChild("Right Shoulder 2"),
  345. Character.Torso:FindFirstChild("Left Shoulder 2"),
  346. Character.Torso:FindFirstChild("Right Hip 2"),
  347. Character.Torso:FindFirstChild("Left Hip 2")
  348. }
  349. local Limbs = {
  350. Character:FindFirstChild("Right Arm"),
  351. Character:FindFirstChild("Left Arm"),
  352. Character:FindFirstChild("Right Leg"),
  353. Character:FindFirstChild("Left Leg")
  354. }
  355. if Joints[Limb] == nil then return false end
  356. if Limbs[Limb] == nil then return false end
  357. if Limb == 1 then
  358. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  359. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  360. elseif Limb == 2 then
  361. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  362. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  363. elseif Limb == 3 then
  364. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  365. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  366. elseif Limb == 4 then
  367. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  368. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  369. end
  370. end
  371.  
  372.  
  373. function EnableLimb(Limb, Character)
  374. if Character == 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].Name = "Right Shoulder"
  392. elseif Limb == 2 then
  393. Joints[Limb].Name = "Left Shoulder"
  394. elseif Limb == 3 then
  395. Joints[Limb].Name = "Right Hip"
  396. elseif Limb == 4 then
  397. Joints[Limb].Name = "Left Hip"
  398. end
  399. for i = 1, #Joints do
  400. if Joints[i] == nil then
  401. local Joint = Instance.new("Motor")
  402. if i == 1 then
  403. Joint.Name = "Right Shoulder"
  404. elseif i == 2 then
  405. Joint.Name = "Left Shoulder"
  406. elseif i == 3 then
  407. Joint.Name = "Right Hip"
  408. elseif i == 4 then
  409. Joint.Name = "Left Hip"
  410. end
  411. Joint.Parent = Character.Torso
  412. end
  413. end
  414. Animate = Character:FindFirstChild("Animate")
  415. if Animate == nil then return false end
  416. Animate = Animate:Clone()
  417. Character.Animate:Remove()
  418. Animate.Parent = Character
  419. end
  420.  
  421.  
  422. function playAnimation(format, mouse)
  423. if format == "normal" then
  424. if Player.Character:FindFirstChild("Torso") ~= nil then
  425. for i = 10, 0, -1 do
  426. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  427. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(100 - i), 0)
  428. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
  429. else return false end
  430. wait()
  431. end
  432. else return false end
  433. end
  434. if format == "drinkStart" then
  435. if Player.Character:FindFirstChild("Torso") ~= nil then
  436. for i = 0, 10, 1 do
  437. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  438. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - i / 50, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(100 + i * 3.5), 0)
  439. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
  440. end
  441. wait()
  442. end
  443. end
  444. end
  445. if format == "drinkLoopStart" then
  446. if Player.Character:FindFirstChild("Torso") ~= nil then
  447. for i = 0, 10, 1 do
  448. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  449. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(i * 2), math.rad(135), 0)
  450. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
  451. end
  452. wait()
  453. end
  454. end
  455. end
  456. if format == "drinkLoopStop" then
  457. if Player.Character:FindFirstChild("Torso") ~= nil then
  458. for i = 10, 0, -1 do
  459. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  460. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(i * 2), math.rad(135), 0)
  461. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
  462. end
  463. wait()
  464. end
  465. end
  466. end
  467. if format == "drinkStop" then
  468. if Player.Character:FindFirstChild("Torso") ~= nil then
  469. for i = 10, 0, -1 do
  470. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  471. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - i / 50, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(100 + i * 3.5), 0)
  472. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
  473. end
  474. wait()
  475. end
  476. end
  477. end
  478. end
  479.  
  480.  
  481. function Weld(x, y)
  482. weld = Instance.new("Weld")
  483. weld.Part0 = x
  484. weld.Part1 = y
  485. CJ = CFrame.new(x.Position)
  486. C0 = x.CFrame:inverse() * CJ
  487. C1 = y.CFrame:inverse() * CJ
  488. weld.C0 = C0
  489. weld.C1 = C1
  490. weld.Parent = x
  491. end
  492.  
  493.  
  494. loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
  495.  
  496.  
  497. function onButton1Down(mouse)
  498. if selected == false then return end
  499. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down ~= true and canUse == true then
  500. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  501. Button1Down = true
  502. canUse = false
  503. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  504. if open.Value == false then
  505. Player.Character[Name].Handle.Open:Play()
  506. wait(0.5)
  507. open.Value = true
  508. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  509. canUse = true
  510. elseif contents.Value > 0 then
  511. playAnimation("drinkStart", mouse)
  512. while contents.Value > 0 and Button1Down == true do
  513. local delta = math.random(3, 10)
  514. contents.Value = contents.Value - delta
  515. if contents.Value < 0 then contents.Value = 0 end
  516. script.Parent.Name = tostring(contents.Value).. "%"
  517. if Player.Character == nil then break end
  518. if Player.Character:FindFirstChild(Name) == nil then break end
  519. if Player.Character[Name]:FindFirstChild("Handle") == nil then break end
  520. if Player.Character:FindFirstChild("Humanoid") == nil then break end
  521. Player.Character.Humanoid.Health = Player.Character.Humanoid.Health + (delta / 2)
  522. Player.Character[Name].Handle.Drink.Volume = math.random(50, 80) / 100
  523. Player.Character[Name].Handle.Drink.Pitch = math.random(90, 110) / 100
  524. Player.Character[Name].Handle.Drink:Play()
  525. coroutine.resume(coroutine.create(function() playAnimation("drinkLoopStart", mouse) end))
  526. wait(math.random(9, 11) / 10)
  527. coroutine.resume(coroutine.create(function() playAnimation("drinkLoopStop", mouse) end))
  528. Player.Character[Name].Handle.Drink:Stop()
  529. wait(0.3)
  530. end
  531. playAnimation("drinkStop", mouse)
  532. script.Parent.Name = Name
  533. canUse = true
  534. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  535. else
  536. canUse = true
  537. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  538. end
  539. end
  540. end
  541.  
  542.  
  543. function onButton1Up(mouse)
  544. if selected == false then return end
  545. Button1Down = false
  546. end
  547.  
  548.  
  549. function onKeyDown(key, mouse)
  550. if selected == false then return end
  551. key = key:lower()
  552. if key == "q" and Button1Down == false and canUse == true then
  553. if mouse.Target == nil then return end
  554. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  555. onDeselected(mouse)
  556. removeParts("holster")
  557. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  558. end
  559. end
  560. if key == "z" and Button1Down == false and canUse == true then
  561. if Player.Character:FindFirstChild(Name) == nil then makeParts("hand") end
  562. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  563. canUse = false
  564. SetAngle(1, math.rad(200), Player.Character)
  565. SetSpeed(1, 0.5, Player.Character)
  566. wait(0.3)
  567. SetAngle(1, math.rad(0), Player.Character)
  568. SetSpeed(1, 0.75, Player.Character)
  569. wait(0.05)
  570. if Player.Character[Name].Handle:FindFirstChild("Weld") ~= nil then Player.Character[Name].Handle.Weld:Remove() end
  571. bodyVelocity = Instance.new("BodyVelocity")
  572. bodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  573. bodyVelocity.velocity = (mouse.Hit.p - Player.Character[Name].Handle.Position).unit * 100
  574. bodyVelocity.Parent = Player.Character[Name].Handle
  575. Player.Character[Name].Handle.Open:Stop()
  576. Player.Character[Name].Handle.Drink:Stop()
  577. Player.Character[Name].Handle.Throw.PlayOnRemove = true
  578. Player.Character[Name].Handle.Throw:Remove()
  579. wait(0.25)
  580. bodyVelocity:Remove()
  581. local model = Player.Character[Name]
  582. model.Parent = Workspace
  583. model:MakeJoints()
  584. onDeselected(mouse)
  585. removeParts("holster")
  586. script.Parent:Remove()
  587. end
  588. end
  589.  
  590.  
  591. function onSelected(mouse)
  592. if selected == true then return end
  593. selected = true
  594. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  595. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  596. if Player.Character.WeaponActivated.Value == nil then break end
  597. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  598. wait()
  599. end
  600. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  601. removeParts("holster")
  602. makeParts("hand")
  603. weapon = Instance.new("ObjectValue")
  604. weapon.Name = "WeaponActivated"
  605. weapon.Value = script.Parent
  606. weapon.Parent = Player.Character
  607. DisableLimb(1, Player.Character)
  608. SetAngle(1, math.rad(90), Player.Character)
  609. if playAnimation("normal") == false then onDeselected(mouse) end
  610. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  611. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  612. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  613. end
  614.  
  615.  
  616. function onDeselected(mouse)
  617. if selected == false then return end
  618. selected = false
  619. while Button1Down == true do
  620. wait()
  621. end
  622. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  623. if Player.Character.WeaponActivated.Value == script.Parent then
  624. Player.Character.WeaponActivated:Remove()
  625. end
  626. end
  627. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  628. if Player.Character.WeaponActivated.Value == nil then break end
  629. if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
  630. wait()
  631. end
  632. removeParts("hand")
  633. makeParts("holster")
  634. SetAngle(1, 0, Player.Character)
  635. ResetLimbCFrame(1, Player.Character)
  636. EnableLimb(1, Player.Character)
  637. end
  638.  
  639.  
  640. if script.Parent.ClassName ~= "HopperBin" then
  641. if Player == nil then print("Error: Player not found!") return end
  642. Tool = Instance.new("HopperBin")
  643. Tool.Name = Name
  644. Tool.Parent = Player.Backpack
  645. script.Name = "Main"
  646. script.Parent = Tool
  647. elseif script.Parent.ClassName == "HopperBin" then
  648. while script.Parent.Parent.ClassName ~= "Backpack" do
  649. wait()
  650. end
  651. if script.Parent:FindFirstChild("Contents") == nil then
  652. contents = Instance.new("NumberValue")
  653. contents.Name = "Contents"
  654. contents.Value = 100
  655. contents.Parent = script.Parent
  656. else
  657. contents = script.Parent.Contents
  658. end
  659. if script.Parent:FindFirstChild("Opened") == nil then
  660. open = Instance.new("BoolValue")
  661. open.Name = "Opened"
  662. open.Value = false
  663. open.Parent = script.Parent
  664. else
  665. open = script.Parent.Opened
  666. end
  667. Player = script.Parent.Parent.Parent
  668. makeParts("holster")
  669. script.Parent.Selected:connect(onSelected)
  670. script.Parent.Deselected:connect(onDeselected)
  671. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement