Advertisement
lafur

Untitled

Aug 31st, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.13 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,Mouse,mouse,UserInputService,ContextActionService = owner
  4. local RealPlayer = Player
  5. do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end ------------------------------------------------------------------------------------------------------------------------------
  6. --[[
  7. // Pepsi-Cola Tool
  8. // @SkySpell [10/09/15]
  9.  
  10. A basic replication of Pepsico's Pepsi. It also has a
  11. cool feature ;).
  12. --]]
  13. -- Variables
  14. ------------------------------------------------------------------------------------------------------------------------------
  15.  
  16. -- Services
  17. local Players = game:GetService("Players")
  18. local RbxUtil = LoadLibrary("RbxUtility")
  19. local Create = RbxUtil.Create
  20. local CProvider = game:GetService("ContentProvider")
  21.  
  22. -- Tool
  23. local Tool = script.Parent
  24. local Handle = Tool:WaitForChild("Handle")
  25.  
  26. local Sounds = {
  27. Open = { Sound = Handle:WaitForChild("Open"); Pitch = 1; Volume = 1; IsLooped = false };
  28. Drink = { Sound = Handle:WaitForChild("Drink"); Pitch = 1; Volume = 1; IsLooped = false };
  29. Pepsiman = { Sound = Handle:WaitForChild("Pepsiman"); Pitch = 1; Volume = 1; IsLooped = false }
  30. }
  31.  
  32. local Animations = {
  33. Pose = {Animation = Tool:WaitForChild("Pose"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = 5}
  34. }
  35.  
  36. ---------------------------------------------
  37.  
  38. local Content = (script:FindFirstChild("Content") or Create("Folder"){
  39. Name = "Content";
  40. Parent = script
  41. })
  42.  
  43. local PepsimanCont = (Content:FindFirstChild("Pepsiman") or Create("Folder"){
  44. Name = "Pepsiman";
  45. Parent = Content
  46. })
  47.  
  48. ---------------------------------------------
  49.  
  50. local ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
  51. Name = "ServerControl",
  52. Parent = Tool,
  53. })
  54.  
  55. local ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
  56. Name = "ClientControl",
  57. Parent = Tool,
  58. })
  59.  
  60. ---------------------------------------------
  61.  
  62. -- Script
  63. local Enabled = true
  64. local ToolEquipped = false
  65. local Pepsified = false
  66.  
  67. local Settings = {
  68. Sounds = true,
  69. Pepsiman = true,
  70. Animations = false,
  71. }
  72.  
  73. local PepsimanLib = {
  74. ---------------------------------------------
  75. Settings = {
  76. Speed = 25,
  77. Health = 1000,
  78. Jump = 100,
  79. };
  80. ---------------------------------------------
  81. Shirt = Create("Shirt"){
  82. Name = "Pepsiman_Shirt",
  83. ShirtTemplate = "http://www.roblox.com/asset/?id=192507181",
  84. Parent = PepsimanCont,
  85. };
  86.  
  87. Pants = Create("Pants"){
  88. Name = "Pepsiman_Pants",
  89. PantsTemplate = "http://www.roblox.com/asset/?id=192908520",
  90. Parent = PepsimanCont
  91. };
  92. ---------------------------------------------
  93. }
  94.  
  95. for i, charobj in pairs(script:GetChildren()) do
  96. if charobj:IsA("CharacterMesh") or charobj:IsA("BodyColors") then
  97. charobj.Parent = PepsimanCont
  98. end
  99. end
  100.  
  101. print("passed variables")
  102.  
  103. ---------------------------------------------------------------------------------------------------------------------------
  104. -- Functions
  105. ---------------------------------------------------------------------------------------------------------------------------
  106.  
  107. function InvokeClient(Mode, Value)
  108. local ClientReturn = nil
  109. pcall(function()
  110. ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
  111. end)
  112. return ClientReturn
  113. end
  114.  
  115. ServerControl.OnServerInvoke = (function(player, Mode, Value)
  116. if player ~= Player or not ToolEquipped or not Mode or not Value then
  117. return
  118. end
  119. end)
  120.  
  121. local function PlaySound(object)
  122. if object.Sound then
  123. local Sound = object.Sound
  124. Sound.Pitch = object.Pitch or 1
  125. Sound.Volume = object.Volume or .5
  126. Sound.Looped = object.IsLooped or false
  127.  
  128. Sound:Play()
  129. else
  130. warn("[SODA] Sound does not exist in the object.")
  131. return
  132. end
  133. end
  134.  
  135. local function StopSound(object)
  136. if object.Sound then
  137. local Sound = object.Sound
  138. Sound:Stop()
  139. else
  140. warn("[SODA] Sound does not exist in the object.")
  141. return
  142. end
  143. end
  144.  
  145. local function SetGrip(mode)
  146. if mode == "Drink" then
  147. Tool.GripForward = Vector3.new(0, -.759, -.651)
  148. Tool.GripPos = Vector3.new(1.5, -.5, .3)
  149. Tool.GripRight = Vector3.new(1, 0, 0)
  150. Tool.GripUp = Vector3.new(0, .651, -.759)
  151. elseif mode == "Stand" then
  152. Tool.GripForward = Vector3.new(-.976,0,-0.217)
  153. Tool.GripPos = Vector3.new(0.03,0,0)
  154. Tool.GripRight = Vector3.new(.217,0,-.976)
  155. Tool.GripUp = Vector3.new(0,1,0)
  156. else
  157. warn("[SODA] The value that the function 'SetGrip' is set to is not valid.")
  158. return
  159. end
  160. end
  161.  
  162. local function SetSpeed(mode, customvalue)
  163. if mode == "Run" then
  164. Humanoid.WalkSpeed = PepsimanLib.Settings.Speed
  165. elseif mode == "Walk" then
  166. Humanoid.WalkSpeed = 16
  167. elseif mode == "Custom" and customvalue then -- IN CASE I WANT TO.
  168. Humanoid.WalkSpeed = customvalue
  169. else
  170. warn("[SODA] The value that the function 'SetSpeed' is set to is not valid.")
  171. return
  172. end
  173. end
  174.  
  175. local function ForceExplosion()
  176. local Explosion = Create("Explosion"){
  177. Name = "Pepsiman_EXPLOSION",
  178. Parent = Torso,
  179. BlastRadius = 10,
  180. BlastPressure = 0,
  181. ExplosionType = Enum.ExplosionType.NoCraters,
  182. DestroyJointRadiusPercent = 0,
  183. Position = Torso.Position
  184. }
  185. return Explosion
  186. end
  187.  
  188. local function Pepsify()
  189. if not Pepsified then
  190. local EmitClone = script.ParticleEmitter:Clone()
  191. EmitClone.Parent = Torso
  192. EmitClone.Enabled = true
  193. wait(5)
  194. --
  195. ForceExplosion()
  196. EmitClone:Destroy()
  197. InvokeClient("PlayAnimation", Animations.Pose)
  198. --
  199. for i, oldobj in pairs(Character:GetChildren()) do
  200. if oldobj:IsA("Shirt") or oldobj:IsA("Pants") or oldobj:IsA("ShirtGraphic") or oldobj:IsA("CharacterMesh")
  201. or oldobj:IsA("Hat") or oldobj:IsA("BodyColors") then
  202. oldobj:Destroy()
  203. end
  204. end
  205. --
  206. for i, oldheadobj in pairs(Head:GetChildren()) do
  207. if oldheadobj:IsA("Decal") then
  208. oldheadobj:Destroy()
  209. end
  210. end
  211. --
  212. for i, newobj in pairs(PepsimanCont:GetChildren()) do
  213. local newclone = newobj:Clone()
  214. newclone.Parent = Character
  215. end
  216. --
  217. PlaySound(Sounds.Pepsiman)
  218. --
  219. SetSpeed("Run")
  220. --
  221. Pepsified = true
  222. end
  223. end
  224.  
  225. local function Activation()
  226. if Enabled and ToolEquipped then
  227. Enabled = false
  228. PlaySound(Sounds.Drink)
  229. SetGrip("Drink")
  230. --
  231. wait(2)
  232. --
  233. SetGrip("Stand")
  234. --
  235. if Settings.Pepsiman == true and not Pepsified then
  236. Pepsify()
  237. end
  238. --
  239. Enabled = true
  240. end
  241. end
  242.  
  243. ---------------------------------------------------------------------------------------------------------------------------
  244. -- Tool Logic
  245. ---------------------------------------------------------------------------------------------------------------------------
  246.  
  247. Tool.Equipped:connect(function()
  248. ToolEquipped = true
  249. Character = Tool.Parent
  250. Head = Character:WaitForChild("Head")
  251. Humanoid = Character:WaitForChild("Humanoid")
  252. Torso = Character:WaitForChild("Torso")
  253. Player = Players:GetPlayerFromCharacter(Character)
  254.  
  255. InvokeClient("Preload", Tool.Pose.AnimationId)
  256. PlaySound(Sounds.Open)
  257. end)
  258.  
  259. Tool.Unequipped:connect(function()
  260. ToolEquipped = false
  261. --
  262. for i, v in pairs(Sounds) do
  263. if v.Sound then
  264. StopSound(v)
  265. end
  266. end
  267. --
  268. end)
  269.  
  270. Tool.Activated:connect(Activation)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement