Advertisement
plytalent

first try script =)

Mar 10th, 2019
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.93 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,game,owner = owner,game
  3. local RealPlayer = Player
  4. do
  5. print("FE Compatibility code by Mokiros")
  6. local rp = RealPlayer
  7. script.Parent = rp.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent then
  33. for _,f in pairs(t.Functions) do
  34. f(...)
  35. end
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=rp then return end
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. if not io.isMouse then
  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 Mouse = Player:GetMouse()
  66. local UIS = game:GetService("UserInputService")
  67. local input = function(io,a)
  68. if a then return end
  69. --Since InputObject is a client-side instance, we create and pass table instead
  70. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  71. end
  72. UIS.InputBegan:Connect(input)
  73. UIS.InputEnded:Connect(input)
  74.  
  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.  
  85. ----Sandboxed game object that allows the usage of client-side methods and services
  86. --Real game object
  87. local _rg = game
  88.  
  89. --Metatable for fake service
  90. local fsmt = {
  91. __index = function(self,k)
  92. local s = rawget(self,"_RealService")
  93. if s then return s[k] end
  94. end,
  95. __newindex = function(self,k,v)
  96. local s = rawget(self,"_RealService")
  97. if s then s[k]=v end
  98. end,
  99. __call = function(self,...)
  100. local s = rawget(self,"_RealService")
  101. if s then return s(...) end
  102. end
  103. }
  104. local function FakeService(t,RealService)
  105. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106. return setmetatable(t,fsmt)
  107. end
  108.  
  109. --Fake game object
  110. local g = {
  111. GetService = function(self,s)
  112. return self[s]
  113. end,
  114. Players = FakeService({
  115. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116. },"Players"),
  117. UserInputService = FakeService(UIS,"UserInputService"),
  118. ContextActionService = FakeService(CAS,"ContextActionService"),
  119. }
  120. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  121. g.service = g.GetService
  122.  
  123. g.RunService = FakeService({
  124. RenderStepped = _rg:GetService("RunService").Heartbeat,
  125. BindToRenderStep = function(self,name,_,fun)
  126.  
  127. end,
  128. UnbindFromRenderStep = function(self,name)
  129. self._btrs[name]:Disconnect()
  130. end,
  131. },"RunService")
  132.  
  133. setmetatable(g,{
  134. __index=function(self,s)
  135. return _rg:GetService(s) or typeof(_rg[s])=="function"
  136. and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  137. end,
  138. __newindex = fsmt.__newindex,
  139. __call = fsmt.__call
  140. })
  141. --Changing owner to fake player object to support owner:GetMouse()
  142. game,owner = g,g.Players.LocalPlayer
  143. end
  144. ---------------------------||FE Covert||---------------------------
  145. local player = owner
  146. local char = player.Character
  147. --par = workspace:FindFirstChild("PATH")
  148. shi1 = workspace:FindFirstChild("Shield1")
  149. shi2 = workspace:FindFirstChild("Shield2")
  150. shi3 = workspace:FindFirstChild("Shield3")
  151. shi4 = workspace:FindFirstChild("Shield4")
  152. shi5 = workspace:FindFirstChild("Shield5")
  153. shi6 = workspace:FindFirstChild("Shield6")
  154. weld1 =char:FindFirstChild("weld1")
  155. weld2 =char:FindFirstChild("weld2")
  156. weld3 =char:FindFirstChild("weld3")
  157. weld4 =char:FindFirstChild("weld4")
  158. weld5 =char:FindFirstChild("weld5")
  159. weld6 =char:FindFirstChild("weld6")
  160. --if par == nil then
  161. --para = Instance.new("Part",workspace)
  162. --para.Name = "PATH"
  163. --end
  164. if shi1 == nil then
  165. shi1= Instance.new("Part",workspace)
  166. shi1.Name = "Shield1"
  167. shi1.Transparency =0.9
  168. shi1.Position = char.Head.Position
  169. shi1.Size = char.Head.Size
  170. shi1.Anchored = false
  171. shi1.CanCollide = false
  172. end
  173. if shi2 == nil then
  174. shi2= Instance.new("Part",workspace)
  175. shi2.Name = "Shield2"
  176. shi2.Transparency =0.9
  177. shi2.Position = char.Torso.Position
  178. shi2.Size = char.Torso.Size
  179. shi2.Anchored = false
  180. shi2.CanCollide = false
  181. end
  182. if shi3 == nil then
  183. shi3= Instance.new("Part",workspace)
  184. shi3.Name = "Shield3"
  185. shi3.Transparency =0.9
  186. shi3.Position = char["Right Leg"].Position
  187. shi3.Size = char["Right Leg"].Size
  188. shi3.Anchored = false
  189. shi3.CanCollide = false
  190. end
  191. if shi4 == nil then
  192. shi4= Instance.new("Part",workspace)
  193. shi4.Name = "Shield4"
  194. shi4.Transparency =0.9
  195. shi4.Position = char["Left Leg"].Position
  196. shi4.Size = char["Left Leg"].Size
  197. shi4.Anchored = false
  198. shi4.CanCollide = false
  199. end
  200. if shi5 == nil then
  201. shi5= Instance.new("Part",workspace)
  202. shi5.Name = "Shield5"
  203. shi5.Transparency =0.9
  204. shi5.Position =char["Right Arm"].Position
  205. shi5.Size = char["Right Arm"].Size
  206. shi5.Anchored = false
  207. shi5.CanCollide = false
  208. end
  209. if shi6 == nil then
  210. shi6= Instance.new("Part",workspace)
  211. shi6.Name = "Shield6"
  212. shi6.Transparency =0.9
  213. shi6.Position =char["Left Arm"].Position
  214. shi6.Size = char["Left Arm"].Size
  215. shi6.Anchored = false
  216. shi6.CanCollide = false
  217. end
  218. if weld1 == nil then
  219. welde = Instance.new("Weld",char)
  220. welde.Name = "weld1"
  221. welde.Part0 = char.Head
  222. welde.Part1 = shi1
  223. end
  224. if weld2 == nil then
  225. welde = Instance.new("Weld",char)
  226. welde.Name = "weld2"
  227. welde.Part0 = char.Torso
  228. welde.Part1 = shi2
  229. end
  230. if weld3 == nil then
  231. welde = Instance.new("Weld",char)
  232. welde.Name = "weld3"
  233. welde.Part0 = char["Right Leg"]
  234. welde.Part1 = shi3
  235. end
  236. if weld4 == nil then
  237. welde = Instance.new("Weld",char)
  238. welde.Name = "weld4"
  239. welde.Part0 = char["Left Leg"]
  240. welde.Part1 = shi4
  241. end
  242. if weld5 == nil then
  243. welde = Instance.new("Weld",char)
  244. welde.Name = "weld5"
  245. welde.Part0 = char["Right Arm"]
  246. welde.Part1 = shi5
  247. end
  248. if weld6 == nil then
  249. welde = Instance.new("Weld",char)
  250. welde.Name = "weld6"
  251. welde.Part0 = char["Left Arm"]
  252. welde.Part1 = shi6
  253. end
  254. script.Parent = Player.PlayerGui
  255. --par = workspace:FindFirstChild("PATH")
  256. shi1 = workspace:FindFirstChild("Shield1")
  257. shi2 = workspace:FindFirstChild("Shield2")
  258. shi3 = workspace:FindFirstChild("Shield3")
  259. shi4 = workspace:FindFirstChild("Shield4")
  260. shi5 = workspace:FindFirstChild("Shield5")
  261. shi6 = workspace:FindFirstChild("Shield6")
  262. weld1 =char:FindFirstChild("weld1")
  263. weld2 =char:FindFirstChild("weld2")
  264. weld3 =char:FindFirstChild("weld3")
  265. weld4 =char:FindFirstChild("weld4")
  266. weld5 =char:FindFirstChild("weld5")
  267. weld6 =char:FindFirstChild("weld6")
  268. --local mouse = player:GetMouse()
  269. x = 0
  270. y = 0
  271. z = 0
  272. or shi2 == nil or shi3 == nil or shi4 == nil or shi5 == nil or shi6 == nil
  273. function Shild()
  274. if shi1 == nil then
  275. shi1 = Instance.new("Part",workspace)
  276. shi1.Name ="Shield2"
  277. shi1.Position = char.Head.Position
  278. shi1.Size = char.Head.Size
  279. weld1 = Instance.new("Weld",char)
  280. weld1.Part0 = char.Head
  281. weld1.Part1 = shi1
  282. end
  283. if shi2 == nil then
  284. shi2 = Instance.new("Part",workspace)
  285. shi2.Name ="Shield2"
  286. shi2.Position = char.Torso.Position
  287. shi2.Size = char.Torso.Size
  288. weld2 = Instance.new("Weld",char)
  289. weld2.Part0 = char.Torso
  290. weld2.Part1 = shi2
  291. end
  292. if shi3 == nil then
  293. shi3 = Instance.new("Part",workspace)
  294. shi3.Name ="Shield3"
  295. shi3.Position = char["Right Leg"].Position
  296. shi3.Size = char["Right Leg"].Size
  297. weld3 = Instance.new("Weld",char)
  298. weld3.Part0 = char["Right Leg"]
  299. weld3.Part1 = shi3
  300. end
  301. if shi4 == nil then
  302. shi4 = Instance.new("Part",workspace)
  303. shi4.Name ="Shield3"
  304. shi4.Position = char["Left Leg"].Position
  305. shi4.Size = char["Left Leg"].Size
  306. weld4 = Instance.new("Weld",char)
  307. weld4.Part0 = char["Left Leg"]
  308. weld4.Part1 = shi4
  309. end
  310. if shi5 == nil then
  311. shi5 = Instance.new("Part",workspace)
  312. shi5.Name ="Shield3"
  313. shi5.Position = char["Right Arm"].Position
  314. shi5.Size = char["Right Arm"].Size
  315. weld5 = Instance.new("Weld",char)
  316. weld5.Part0 = char["Right Arm"]
  317. weld5.Part1 = shi5
  318. end
  319. if shi6 == nil then
  320. shi6 = Instance.new("Part",workspace)
  321. shi6.Name ="Shield3"
  322. shi6.Position = char["Left Arm"].Position
  323. shi6.Size = char["Left Leg"].Size
  324. weld6 = Instance.new("Weld",char)
  325. weld6.Part0 = char["Left Arm"]
  326. weld6.Part1 = shi6
  327. end
  328. -- if char:FindFirstChild("welded") == nil then
  329. -- weld = Instance.new("Weld",char)
  330. -- weld.Name = "welded"
  331. -- weld.Part0 = char.Torso
  332. -- weld.Part1 = shi
  333. -- end
  334. end
  335. --function flypath()
  336. -- if workspace:FindFirstChild("PATH") ==nil then
  337. -- par = Instance.new("Part",workspace)
  338. -- par.Name ="PATH"
  339. -- par.Position = Vector3.new(char.Torso.Position.x,char.Torso.Position.y - 3.025+ y,char.Torso.Position.z)
  340. -- par.Anchored = true
  341. -- par.Size = Vector3.new(50,0.005,50)
  342. -- par.Transparency = 0.9
  343. -- par.Orientation = Vector3.new(char.Torso.Orientation.x, 0, char.Torso.Orientation.z)
  344. -- else
  345. -- par.Position = Vector3.new(char.Torso.Position.x + x,char.Torso.Position.y - 3.025+ y,char.Torso.Position.z)
  346. -- par.Anchored = true
  347. -- par.Size = Vector3.new(50,0.005,50)
  348. -- par.Transparency = 0.9
  349. -- par.Orientation = Vector3.new(0, 0, 0)
  350. -- end
  351. --end
  352. mouse.KeyDown:connect(function(key)
  353. k = key
  354. if k == "q" then
  355. y = - 1
  356. end
  357. if k == "e" then
  358. y =1
  359. end
  360. end)
  361. mouse.KeyUp:connect(function(key)
  362. k = key
  363. if k == "q" then
  364. y = 0
  365. end
  366. if k == "e" then
  367. y =0
  368. end
  369. end)
  370. while wait(1/60) do
  371. Shild()
  372. -- flypath()
  373. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement