Advertisement
Josemmoya

Untitled

Feb 18th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.22 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86. --A gift
  87. --Run local no name needed
  88. inew=Instance.new
  89. v3=Vector3.new
  90. c3=Color3.new
  91. On=true
  92. Distance=999999999
  93. Minimum=5
  94. Maximum=10000000000000
  95. LightColor=c3(0/255,230/255,150/255)
  96. Light=inew('PointLight')
  97. Light.Color=LightColor
  98. XVec=v3(0,0,0)
  99. Target=nil
  100. Adorn=nil
  101. BP=inew("BodyPosition")
  102. BP.maxForce=v3(9990000, 9990000, 9990000)
  103. BP.P=9990000.000
  104. BP.D=100000.000
  105. BP.position=v3(0,50,0)
  106. Q=false
  107. E=false
  108. hit=nil
  109. FireSize=30
  110. FireColor=c3(255/255,255/255,255/255)
  111. FireHeat=10
  112. RunService=game:GetService('RunService')
  113. Player=owner
  114. coroutine.wrap(function()
  115. script.Parent=nil
  116. RunService.RenderStepped:connect(function()
  117. if On==false then
  118. Adorn=nil
  119. end
  120. hit=Mouse.Hit
  121. Unit=(hit.p-Player.Character.Head.Position).unit
  122. NewPos=Player.Character.Head.Position+(Unit*Distance)-XVec
  123. if BP==nil then
  124. BP=inew("BodyPosition")
  125. else
  126. BP.position=NewPos
  127. end
  128. if Adorn~=nil then
  129. BP.Parent=Adorn
  130. Light.Parent=Adorn
  131. else
  132. BP.Parent=nil
  133. Light.Parent=nil
  134. end
  135. if Mouse.Target~=nil then Target=Mouse.Target else Target=nil end
  136. if Q==true and E==false then
  137. if Distance-2<Minimum then
  138. Distance=Minimum
  139. elseif Distance-2>=Minimum then
  140. Distance=Distance-2
  141. end
  142. end
  143. if Q==false and E==true then
  144. if Distance+2>Maximum then
  145. Distance=Maximum
  146. elseif Distance+2<=Maximum then
  147. Distance=Distance+2
  148. end
  149. end
  150. if Distance<Minimum then
  151. Distance=Minimum
  152. end
  153. end)
  154. end)()
  155. Player.Chatted:connect(function(msg)
  156. if string.lower(string.sub(msg,1,5))=='make/' then
  157. for e=1,tonumber(string.sub(msg,6)) do
  158. local Col=Color3.new(math.random(1,255)/255,math.random(1,255)/255,math.random(1,255)/255)
  159. local br=Instance.new('Part', workspace)
  160. br.Size=Vector3.new(math.random(2,8),math.random(2,8),math.random(2,8))
  161. br.Position=Player.Character.Head.Position+ Vector3.new(math.random(-tonumber(string.sub(msg,6)),tonumber(string.sub(msg,6))), math.random(-tonumber(string.sub(msg,6)),tonumber(string.sub(msg,6))),math.random(-tonumber(string.sub(msg,6)),tonumber(string.sub(msg,6))) )
  162. br.BrickColor=BrickColor.new(Col)
  163. end
  164. end
  165. end)
  166. Mouse.KeyDown:connect(function(key)
  167. if (key)=='q' then
  168. Q=true
  169. elseif (key)=='e' then
  170. E=true
  171. elseif (key)=='t' then
  172. if Adorn~=nil then
  173. BP.Parent=nil
  174. Adorn.Velocity=Adorn.Velocity+(((Adorn.Position+XVec)-Player.Character.Head.Position)).unit*200
  175. Adorn=nil
  176. end
  177. end
  178. end)
  179. Mouse.KeyUp:connect(function(key)
  180. if (key)=='q' then
  181. Q=false
  182. elseif (key)=='e' then
  183. E=false
  184. elseif key=='k' and Adorn~=nil then
  185. for i, v in pairs(Adorn.Parent:GetChildren()) do
  186. if v:IsA('Humanoid') then v.Health=0 end
  187. end
  188. elseif key=='b' and Adorn~=nil then
  189. Adorn:BreakJoints()
  190. elseif (key)=='r' and Adorn ~=nil then
  191. if Adorn.Parent:FindFirstChild('ThisIsAModel') and Adorn.Parent.Fire.Value==false then
  192. for i, var in pairs(Adorn.Parent:GetChildren()) do
  193. if var:IsA('BasePart') then
  194. fire=inew('Fire',var)
  195. fire.Color=FireColor
  196. fire.Name='Fire23445'
  197. fire.Size=FireSize
  198. fire.Heat=FireHeat
  199. end
  200. end
  201. Adorn.Parent.Fire.Value=true
  202. elseif Adorn.Parent:FindFirstChild('ThisIsAModel') and Adorn.Parent.Fire.Value==true then
  203. for i, var in pairs(Adorn.Parent:GetChildren()) do
  204. if var:IsA('BasePart') and var:FindFirstChild('Fire23445') then
  205. var.Fire23445:Destroy()
  206. end
  207. end
  208. Adorn.Parent.Fire.Value=false
  209. elseif not Adorn.Parent:FindFirstChild('ThisIsAModel') then
  210. if not Adorn:FindFirstChild('Fire23445') then
  211. fire=inew('Fire',Adorn)
  212. fire.Color=FireColor
  213. fire.Name='Fire23445'
  214. fire.Size=FireSize
  215. fire.Heat=FireHeat
  216. elseif Adorn:FindFirstChild('Fire23445') then
  217. Adorn.Fire23445:Destroy()
  218. end
  219. end
  220. elseif (key)=='z' and Adorn ~=nil then
  221. if Adorn.Parent:FindFirstChild('ThisIsAModel') then
  222. if Adorn.Parent.Ghost.Value==false then
  223. for i, v in pairs(Adorn.Parent:GetChildren()) do
  224. if v:IsA('BasePart') then
  225. if v.Transparency==0 then
  226. tick=inew('BoolValue',v)
  227. tick.Name='Trans'
  228. v.Transparency=0.5
  229. else
  230. v.Transparency=v.Transparency*2
  231. end
  232. end
  233. end
  234. Adorn.Parent.Ghost.Value=true
  235. elseif Adorn.Parent.Ghost.Value==true then
  236. for i, v in pairs(Adorn.Parent:GetChildren()) do
  237. if v:IsA('BasePart') then
  238. if v:FindFirstChild('Trans') then
  239. v.Transparency=0
  240. v.Trans:Destroy()
  241. else
  242. v.Transparency=v.Transparency/2
  243. end
  244. end
  245. end
  246. Adorn.Parent.Ghost.Value=false
  247. end
  248. elseif not Adorn.Parent:FindFirstChild('ThisIsAModel') then
  249. if Adorn:FindFirstChild('Trans') then
  250. Adorn.Transparency=Adorn.Transparency/2
  251. Adorn.Trans:Destroy()
  252. if Adorn:FindFirstChild('Trans2') then
  253. Adorn.Transparency=0
  254. Adorn.Trans2:Destroy()
  255. end
  256. elseif not Adorn:FindFirstChild('Trans') then
  257. inew('BoolValue',Adorn).Name='Trans'
  258. if Adorn.Transparency<=0 then
  259. inew('BoolValue',Adorn).Name='Trans2'
  260. Adorn.Transparency=0.5
  261. else Adorn.Transparency=Adorn.Transparency*2
  262. end
  263. end
  264. end
  265. end
  266. end)
  267. Mouse.Button1Down:connect(function()
  268. if Adorn==nil and BP.Parent==nil and Target~=nil and (hit.p-Player.Character.Head.Position).magnitude<=Maximum and Target:IsDescendantOf(workspace) then
  269. Distance=(Target.Position-Player.Character.Head.Position).magnitude
  270. XVec=(hit.p-Target.Position)
  271. if not Target.Parent:FindFirstChild('ThisIsAModel') then
  272. local rt=Target.Size
  273. Minimum=math.sqrt((rt.X^2+rt.Y^2+rt.Z^2))+.5
  274. else
  275. local rt=Target.Parent:GetModelSize()
  276. Minimum=math.sqrt((rt.X^2+rt.Y^2+rt.Z^2))+.5
  277. end
  278. Adorn=Target
  279. end
  280. end)
  281.  
  282. Mouse.Button1Up:connect(function()
  283. if Adorn~=nil then
  284. Adorn=nil
  285. BP.Parent=nil
  286. end
  287. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement