Advertisement
Godofadmin1337

FE wind summoning horn

Sep 8th, 2018
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.84 KB | None | 0 0
  1.  
  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 by Mokiros")
  7. local rp = RealPlayer
  8. script.Parent = rp.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,Functions={},Connect=function(self,f)table.insert(self.Functions,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(),Button2Up=fakeEvent(),Button2Down=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 then
  34. for _,f in pairs(t.Functions) do
  35. f(...)
  36. end
  37. end
  38. end
  39. m.TrigEvent = te
  40. UIS.TrigEvent = te
  41.  
  42. Event.OnServerEvent:Connect(function(plr,io)
  43. if plr~=rp then return end
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. if not io.isMouse then
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  52. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  53. end
  54. for _,t in pairs(CAS.Actions) do
  55. for _,k in pairs(t.Keys) do
  56. if k==io.KeyCode then
  57. t.Function(t.Name,io.UserInputState,io)
  58. end
  59. end
  60. end
  61. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  62. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  63. end
  64. end)
  65. Event.Parent = NLS([==[
  66. local Player = game:GetService("Players").LocalPlayer
  67. local Event = script:WaitForChild("UserInput_Event")
  68. local Mouse = Player:GetMouse()
  69. local UIS = game:GetService("UserInputService")
  70. local input = function(io,a)
  71. if a then return end
  72. --Since InputObject is a client-side instance, we create and pass table instead
  73. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  74. end
  75. UIS.InputBegan:Connect(input)
  76. UIS.InputEnded:Connect(input)
  77. local h,t
  78. --Give the server mouse data 30 times every second, but only if the values changed
  79. --If player is not moving their mouse, client won't fire events
  80. while wait(1/30) do
  81. if h~=Mouse.Hit or t~=Mouse.Target then
  82. h,t=Mouse.Hit,Mouse.Target
  83. Event:FireServer({isMouse=true,Target=t,Hit=h})
  84. end
  85. end]==],Player.Character)
  86.  
  87. ----Sandboxed game object that allows the usage of client-side methods and services
  88. --Real game object
  89. local _rg = game
  90.  
  91. --Metatable for fake service
  92. local fsmt = {
  93. __index = function(self,k)
  94. local s = rawget(self,"_RealService")
  95. if s then
  96. return typeof(s[k])=="function"
  97. and function(_,...)return s[k](s,...)end or s[k]
  98. end
  99. end,
  100. __newindex = function(self,k,v)
  101. local s = rawget(self,"_RealService")
  102. if s then s[k]=v end
  103. end
  104. }
  105. local function FakeService(t,RealService)
  106. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  107. return setmetatable(t,fsmt)
  108. end
  109.  
  110. --Fake game object
  111. local g = {
  112. GetService = function(self,s)
  113. return rawget(self,s) or _rg:GetService(s)
  114. end,
  115. Players = FakeService({
  116. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  117. },"Players"),
  118. UserInputService = FakeService(UIS,"UserInputService"),
  119. ContextActionService = FakeService(CAS,"ContextActionService"),
  120. RunService = FakeService({
  121. _btrs = {},
  122. RenderStepped = _rg:GetService("RunService").Heartbeat,
  123. BindToRenderStep = function(self,name,_,fun)
  124. self._btrs[name] = self.Heartbeat:Connect(fun)
  125. end,
  126. UnbindFromRenderStep = function(self,name)
  127. self._btrs[name]:Disconnect()
  128. end,
  129. },"RunService")
  130. }
  131. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  132. g.service = g.GetService
  133. FakeService(g,game)
  134. --Changing owner to fake player object to support owner:GetMouse()
  135. game,owner = g,g.Players.LocalPlayer
  136. end
  137.  
  138. function sandbox(var,func)
  139. local env = getfenv(func)
  140. local newenv = setmetatable({},{
  141. __index = function(self,k)
  142. if k=="script" then
  143. return var
  144. else
  145. return env[k]
  146. end
  147. end,
  148. })
  149. setfenv(func,newenv)
  150. return func
  151. end
  152. cors = {}
  153. mas = Instance.new("Model",game:GetService("Lighting"))
  154. Tool0 = Instance.new("Tool")
  155. Part1 = Instance.new("Part")
  156. SpecialMesh2 = Instance.new("SpecialMesh")
  157. Sound3 = Instance.new("Sound")
  158. LocalScript4 = Instance.new("LocalScript")
  159. Script5 = Instance.new("Script")
  160. Script6 = Instance.new("Script")
  161. Animation7 = Instance.new("Animation")
  162. Script8 = Instance.new("Script")
  163. LocalScript9 = Instance.new("LocalScript")
  164. Tool0.Name = "Knights of the Splintered Sky: Wind Summoning Horn"
  165. Tool0.Parent = mas
  166. Tool0.TextureId = "http://www.roblox.com/asset?id=127398046"
  167. Tool0.GripForward = Vector3.new(-0, 1, -0)
  168. Tool0.GripPos = Vector3.new(0.100000001, -0.600000024, 0.400000006)
  169. Tool0.GripUp = Vector3.new(0, 0, 1)
  170. Tool0.ToolTip = "Sunder the sky."
  171. Part1.Name = "Handle"
  172. Part1.Parent = Tool0
  173. Part1.FormFactor = Enum.FormFactor.Custom
  174. Part1.Size = Vector3.new(2.18000174, 2.08999944, 3.93999815)
  175. Part1.CFrame = CFrame.new(0.100000001, 17.2000008, 22.0000019, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  176. Part1.Position = Vector3.new(0.100000001, 17.2000008, 22.0000019)
  177. SpecialMesh2.Parent = Part1
  178. SpecialMesh2.MeshId = "http://www.roblox.com/asset?id=127397719"
  179. SpecialMesh2.TextureId = "http://www.roblox.com/asset?id=127397916"
  180. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  181. Sound3.Name = "BlowSound"
  182. Sound3.Parent = Part1
  183. Sound3.SoundId = "http://www.roblox.com/asset?id=127403796"
  184. LocalScript4.Name = "EventsAndAnims"
  185. LocalScript4.Parent = Tool0
  186. table.insert(cors,sandbox(LocalScript4,function()
  187. local Tool = script.Parent
  188. local Handle = Tool:WaitForChild('Handle')
  189. local EnableScript = script:WaitForChild('EnableScript')
  190. local TornadoScript = Tool:WaitForChild('TornadoScript')
  191.  
  192. local Anims = {}
  193. local BlowSound
  194.  
  195. local Debris = game:GetService('Debris')
  196.  
  197. local TIME_BEFORE_SOUND = 0.5
  198. local TIME_AFTER_SOUND = 4.5
  199. local TIME_BETWEEN_USES = 20
  200. local TORNADO_RADIUS = 15
  201. local TORNADO_HEIGHT = 200
  202. local TORNADO_SPEED = 10
  203. local TORNADO_TIME = 10
  204. local SPACE_BETWEEN_TORNADOES = 5
  205. local NUM_TORNADOES = 6
  206. local GRAVITY = 196.2
  207.  
  208. local TORSO_HEIGHT = 3
  209.  
  210. local Tornado = Instance.new('Part')
  211. Tornado.Name = "Tornado"
  212. Tornado.FormFactor = Enum.FormFactor.Symmetric
  213. Tornado.CanCollide = false
  214. Tornado.Size = Vector3.new(TORNADO_RADIUS, TORNADO_HEIGHT, TORNADO_RADIUS)
  215. Tornado.BrickColor = BrickColor.new('Pastel Blue')
  216. Tornado.Transparency = 0.4
  217. local CylinderMesh = Instance.new('CylinderMesh')
  218. CylinderMesh.Parent = Tornado
  219. local BodyVelocity = Instance.new('BodyVelocity')
  220. BodyVelocity.Parent = Tornado
  221. BodyVelocity.maxForce = Vector3.new(1E6,0,1E6)
  222. BodyVelocity.P = 1E6
  223. local BodyForce = Instance.new('BodyForce')
  224. BodyForce.force = Vector3.new(0, GRAVITY * Tornado:GetMass(), 0)
  225. BodyForce.Parent = Tornado
  226. local Ignore = Instance.new('ObjectValue')
  227. Ignore.Name = 'Ignore'
  228. Ignore.Parent = Tornado
  229. local TornadoScriptClone = TornadoScript:Clone()
  230. TornadoScriptClone.Disabled = false
  231. TornadoScriptClone.Parent = Tornado
  232.  
  233.  
  234. local function Play(animationName)
  235. if not Anims[animationName] then
  236. local humanoid = Tool.Parent:FindFirstChild('Humanoid')
  237. if humanoid and humanoid:IsA('Humanoid') then
  238. local unloadedAnim = Tool:FindFirstChild(animationName)
  239. if unloadedAnim then
  240. Anims[animationName] = humanoid:LoadAnimation(unloadedAnim)
  241. end
  242. end
  243. end
  244. if Anims[animationName] then
  245. Anims[animationName]:Play()
  246. end
  247. end
  248.  
  249. local function Stop(animationName)
  250. if Anims[animationName] then
  251. Anims[animationName]:Stop()
  252. end
  253. end
  254.  
  255. function OnActivated()
  256. if Tool.Enabled then
  257. Tool.Enabled = false
  258. local enableScriptClone = EnableScript:Clone()
  259. enableScriptClone.Parent = Tool
  260. enableScriptClone.Disabled = false
  261.  
  262. local character = Tool.Parent
  263. local torso = character:FindFirstChild('Torso')
  264. if character and character:FindFirstChild('Humanoid') then
  265. Play('BlowAnim')
  266. wait(TIME_BEFORE_SOUND)
  267. BlowSound = Handle:FindFirstChild('BlowSound')
  268. if BlowSound then BlowSound:Play() end
  269. local rightVector = torso.CFrame.lookVector:Cross(Vector3.new(0,1,0))
  270. for i = 1, NUM_TORNADOES do
  271. local tornadoClone = Tornado:Clone()
  272. tornadoClone:WaitForChild('Ignore').Value = character
  273. tornadoClone.Parent = Workspace
  274. local position = torso.Position + Vector3.new(0, TORNADO_HEIGHT/2 - TORSO_HEIGHT, 0) + (i - (NUM_TORNADOES + 1) / 2) * (TORNADO_RADIUS + SPACE_BETWEEN_TORNADOES) * rightVector
  275. tornadoClone.CFrame = CFrame.new(position)
  276. tornadoClone:WaitForChild('BodyVelocity').velocity = TORNADO_SPEED * torso.CFrame.lookVector
  277. end
  278. end
  279. end
  280. end
  281.  
  282. function OnEquipped()
  283. end
  284.  
  285. function OnUnequipped()
  286. Stop('BlowAnim')
  287. if BlowSound then BlowSound:Stop() end
  288. end
  289.  
  290.  
  291. Tool.Equipped:connect(OnEquipped)
  292. Tool.Activated:connect(OnActivated)
  293. Tool.Unequipped:connect(OnUnequipped)
  294.  
  295.  
  296. end))
  297. Script5.Name = "EnableScript"
  298. Script5.Parent = LocalScript4
  299. Script5.Disabled = true
  300. table.insert(cors,sandbox(Script5,function()
  301. local TIME_UNTIL_ENABLED = 1
  302. wait(TIME_UNTIL_ENABLED)
  303. if script.Parent then
  304. script.Parent.Enabled = true
  305. end
  306. script:Destroy()
  307.  
  308. end))
  309. Script6.Name = "MotorizeRightGrip"
  310. Script6.Parent = LocalScript4
  311. table.insert(cors,sandbox(Script6,function()
  312. -- stravant's AnimEdit helper, to make sure tools actually animate.
  313.  
  314. function Create(ty)
  315. return function(data)
  316. local obj = Instance.new(ty)
  317. for k, v in pairs(data) do
  318. if type(k) == 'number' then
  319. v.Parent = obj
  320. else
  321. obj[k] = v
  322. end
  323. end
  324. return obj
  325. end
  326. end
  327.  
  328. local Tool = script.Parent.Parent
  329.  
  330. local armChildRemovedConn = nil
  331. local Motor6DGrip = nil
  332. local EquippedNum = 0
  333.  
  334. Tool.Equipped:connect(function()
  335. EquippedNum = EquippedNum + 1
  336. local myEquip = EquippedNum
  337. --some vars
  338. local Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
  339. local Character = Player.Character
  340.  
  341. local rightarm = Character:FindFirstChild('Right Arm')
  342. if rightarm and rightarm:FindFirstChild('RightGrip') then
  343. local rightGrip = rightarm['RightGrip']
  344. local handle = rightGrip.Part1
  345.  
  346. --kill my joint when the normal joint is removed
  347. --this must be done here so that the joint is removed
  348. --_right away_ after unequipping and the character doesn't
  349. --glitch up.
  350. local armChildRemovedConn = rightarm.ChildRemoved:connect(function(ch)
  351. if ch == rightGrip then
  352. Motor6DGrip:Remove()
  353. Motor6DGrip = nil
  354. --
  355. if handle and Character:FindFirstChild('Torso') then
  356. if Tool.Parent.Parent:IsA('Player') then
  357. --the sword has been deselected
  358. --put the sword far away so the user doesn't notice that the handle doesn't
  359. --update for about 0.1 seconds after selecting the tool.
  360. handle.CFrame = CFrame.new(100000, 100000, 100000)
  361. else
  362. --if in the workspace, position the handle where it should be dropped
  363. --use the size of the handle to make sure it's dropped far enough away
  364. handle.CFrame = Character.Torso.CFrame * CFrame.new(0, 0, -(handle.Size.magnitude+2))
  365. end
  366. end
  367. end
  368. end)
  369.  
  370. --make my new joint
  371. Motor6DGrip = Create'Motor6D'{
  372. Name = 'RightGrip_Motor';
  373. Part0 = rightarm;
  374. Part1 = handle;
  375. C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0); -- from original right grip
  376. C1 = CFrame.new(0.1, -0.6, 0.4, 1, 0, 0, 0, 0, -1, 0, 1, 0);
  377. }
  378. --kill the old weld
  379. rightGrip.Part1 = nil
  380. rightGrip.Part0 = nil
  381. Motor6DGrip.Parent = rightGrip.Parent
  382. end
  383. end)
  384.  
  385. Tool.Unequipped:connect(function()
  386. EquippedNum = EquippedNum + 1
  387. if armChildRemovedConn then
  388. armChildRemovedConn:disconnect()
  389. armChildRemovedConn = nil
  390. end
  391. end)
  392.  
  393. end))
  394. Animation7.Name = "BlowAnim"
  395. Animation7.Parent = Tool0
  396. Animation7.AnimationId = "http://www.roblox.com/asset?id=127405384"
  397. Script8.Name = "TornadoScript"
  398. Script8.Parent = Tool0
  399. Script8.Disabled = true
  400. table.insert(cors,sandbox(Script8,function()
  401. --
  402. local Tornado = script.Parent
  403. local IgnoreChar = Tornado:WaitForChild('Ignore').Value
  404.  
  405. local PartInfo = {}
  406. local StuffToDestroy = {}
  407.  
  408. local bpTable = {}
  409. local startRadTable = {}
  410.  
  411. local NUM_STEPS = 100
  412. local STEP_TIME = 5.1
  413.  
  414. -- Copied from HotThoth's code for the Tornade. SECRET RETEXTURE MUWAHAHAHA
  415. Tornado.Touched:connect(function(part)
  416. if part.Parent and part.Parent ~= IgnoreChar then
  417. if part.Parent.Parent and part.Parent.Parent == IgnoreChar then -- check for initiating character's hat
  418. return
  419. end
  420.  
  421. part:BreakJoints()
  422.  
  423. local spinForce = part:FindFirstChild('KOSSGustTornadoSpin')
  424. if spinForce == nil then
  425. local spinForce = Instance.new('BodyAngularVelocity')
  426. spinForce.P = 1000000
  427. spinForce.angularvelocity = Vector3.new(0,50,0)
  428. spinForce.maxTorque = Vector3.new(spinForce.P,spinForce.P,spinForce.P)
  429. spinForce.Name = 'KOSSGustTornadoSpin'
  430. spinForce.Parent = part
  431. table.insert(StuffToDestroy, spinForce)
  432. end
  433.  
  434. local newBV = part:FindFirstChild('KOSSGustTornadoLift')
  435. if newBV == nil then
  436. newBV = Instance.new("BodyVelocity")
  437. newBV.Name = 'KOSSGustTornadoLift'
  438. newBV.P = 100000
  439. newBV.maxForce = Vector3.new(0, newBV.P, 0)
  440. newBV.velocity = Vector3.new(0, 16, 0)
  441. newBV.Parent = part
  442. table.insert(StuffToDestroy, newBV)
  443. end
  444.  
  445. local newBP = part:FindFirstChild('KOSSGustTornadoPos')
  446. if newBP == nil then
  447. newBP = Instance.new("BodyPosition")
  448. newBP.Name = 'KOSSGustTornadoPos'
  449. newBP.P = 100000
  450. newBP.maxForce = Vector3.new(newBP.P, 0, newBP.P)
  451. newBP.position = part.Position
  452. newBP.Parent = part
  453. table.insert(bpTable, newBP)
  454. table.insert(startRadTable, (part.Position - Tornado.Position)*Vector3.new(1, 0, 1))
  455. table.insert(StuffToDestroy, newBP)
  456. end
  457. end
  458. end)
  459.  
  460. for i = 1, NUM_STEPS do
  461. for i = 1, #bpTable do
  462. bpTable[i].position = Tornado.Position + startRadTable[i]
  463. startRadTable[i] = CFrame.Angles(0, .7, 0)*startRadTable[i]
  464. end
  465. wait(STEP_TIME)
  466. end
  467. for _, thing in pairs(StuffToDestroy) do
  468. thing:Destroy()
  469. end
  470. Tornado:Destroy()
  471. --
  472. end))
  473. LocalScript9.Name = "Local Gui"
  474. LocalScript9.Parent = Tool0
  475. table.insert(cors,sandbox(LocalScript9,function()
  476. Tool = script.Parent
  477.  
  478. local stillEquipped = false
  479.  
  480. function onEquippedLocal(mouse)
  481. stillEquipped = true
  482. if mouse == nil then
  483. print("Mouse not found")
  484. return
  485. end
  486. while stillEquipped do
  487. print("Setting Mouse to go")
  488. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  489. while Tool.Enabled and stillEquipped do
  490. wait(0.01)
  491. end
  492. print("Setting Mouse to wait")
  493. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  494. while not Tool.Enabled and stillEquipped do
  495. wait(0.01)
  496. end
  497. end
  498. end
  499.  
  500.  
  501. function onUnequippedLocal()
  502. stillEquipped = false
  503. end
  504.  
  505. Tool.Equipped:connect(onEquippedLocal)
  506. Tool.Unequipped:connect(onUnequippedLocal)
  507.  
  508. end))
  509. for i,v in pairs(mas:GetChildren()) do
  510. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  511. pcall(function() v:MakeJoints() end)
  512. end
  513. mas:Destroy()
  514. for i,v in pairs(cors) do
  515. spawn(function()
  516. pcall(v)
  517. end)
  518. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement