Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code by Mokiros")
- local rp = RealPlayer
- script.Parent = rp.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return m:TrigEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local Mouse = Player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return rawget(self,s) or _rg:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = _rg:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- FakeService(g,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Sound3 = Instance.new("Sound")
- LocalScript4 = Instance.new("LocalScript")
- Script5 = Instance.new("Script")
- Script6 = Instance.new("Script")
- Animation7 = Instance.new("Animation")
- Script8 = Instance.new("Script")
- LocalScript9 = Instance.new("LocalScript")
- Tool0.Name = "Knights of the Splintered Sky: Wind Summoning Horn"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset?id=127398046"
- Tool0.GripForward = Vector3.new(-0, 1, -0)
- Tool0.GripPos = Vector3.new(0.100000001, -0.600000024, 0.400000006)
- Tool0.GripUp = Vector3.new(0, 0, 1)
- Tool0.ToolTip = "Sunder the sky."
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(2.18000174, 2.08999944, 3.93999815)
- Part1.CFrame = CFrame.new(0.100000001, 17.2000008, 22.0000019, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Position = Vector3.new(0.100000001, 17.2000008, 22.0000019)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset?id=127397719"
- SpecialMesh2.TextureId = "http://www.roblox.com/asset?id=127397916"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- Sound3.Name = "BlowSound"
- Sound3.Parent = Part1
- Sound3.SoundId = "http://www.roblox.com/asset?id=127403796"
- LocalScript4.Name = "EventsAndAnims"
- LocalScript4.Parent = Tool0
- table.insert(cors,sandbox(LocalScript4,function()
- local Tool = script.Parent
- local Handle = Tool:WaitForChild('Handle')
- local EnableScript = script:WaitForChild('EnableScript')
- local TornadoScript = Tool:WaitForChild('TornadoScript')
- local Anims = {}
- local BlowSound
- local Debris = game:GetService('Debris')
- local TIME_BEFORE_SOUND = 0.5
- local TIME_AFTER_SOUND = 4.5
- local TIME_BETWEEN_USES = 20
- local TORNADO_RADIUS = 15
- local TORNADO_HEIGHT = 200
- local TORNADO_SPEED = 10
- local TORNADO_TIME = 10
- local SPACE_BETWEEN_TORNADOES = 5
- local NUM_TORNADOES = 6
- local GRAVITY = 196.2
- local TORSO_HEIGHT = 3
- local Tornado = Instance.new('Part')
- Tornado.Name = "Tornado"
- Tornado.FormFactor = Enum.FormFactor.Symmetric
- Tornado.CanCollide = false
- Tornado.Size = Vector3.new(TORNADO_RADIUS, TORNADO_HEIGHT, TORNADO_RADIUS)
- Tornado.BrickColor = BrickColor.new('Pastel Blue')
- Tornado.Transparency = 0.4
- local CylinderMesh = Instance.new('CylinderMesh')
- CylinderMesh.Parent = Tornado
- local BodyVelocity = Instance.new('BodyVelocity')
- BodyVelocity.Parent = Tornado
- BodyVelocity.maxForce = Vector3.new(1E6,0,1E6)
- BodyVelocity.P = 1E6
- local BodyForce = Instance.new('BodyForce')
- BodyForce.force = Vector3.new(0, GRAVITY * Tornado:GetMass(), 0)
- BodyForce.Parent = Tornado
- local Ignore = Instance.new('ObjectValue')
- Ignore.Name = 'Ignore'
- Ignore.Parent = Tornado
- local TornadoScriptClone = TornadoScript:Clone()
- TornadoScriptClone.Disabled = false
- TornadoScriptClone.Parent = Tornado
- local function Play(animationName)
- if not Anims[animationName] then
- local humanoid = Tool.Parent:FindFirstChild('Humanoid')
- if humanoid and humanoid:IsA('Humanoid') then
- local unloadedAnim = Tool:FindFirstChild(animationName)
- if unloadedAnim then
- Anims[animationName] = humanoid:LoadAnimation(unloadedAnim)
- end
- end
- end
- if Anims[animationName] then
- Anims[animationName]:Play()
- end
- end
- local function Stop(animationName)
- if Anims[animationName] then
- Anims[animationName]:Stop()
- end
- end
- function OnActivated()
- if Tool.Enabled then
- Tool.Enabled = false
- local enableScriptClone = EnableScript:Clone()
- enableScriptClone.Parent = Tool
- enableScriptClone.Disabled = false
- local character = Tool.Parent
- local torso = character:FindFirstChild('Torso')
- if character and character:FindFirstChild('Humanoid') then
- Play('BlowAnim')
- wait(TIME_BEFORE_SOUND)
- BlowSound = Handle:FindFirstChild('BlowSound')
- if BlowSound then BlowSound:Play() end
- local rightVector = torso.CFrame.lookVector:Cross(Vector3.new(0,1,0))
- for i = 1, NUM_TORNADOES do
- local tornadoClone = Tornado:Clone()
- tornadoClone:WaitForChild('Ignore').Value = character
- tornadoClone.Parent = Workspace
- local position = torso.Position + Vector3.new(0, TORNADO_HEIGHT/2 - TORSO_HEIGHT, 0) + (i - (NUM_TORNADOES + 1) / 2) * (TORNADO_RADIUS + SPACE_BETWEEN_TORNADOES) * rightVector
- tornadoClone.CFrame = CFrame.new(position)
- tornadoClone:WaitForChild('BodyVelocity').velocity = TORNADO_SPEED * torso.CFrame.lookVector
- end
- end
- end
- end
- function OnEquipped()
- end
- function OnUnequipped()
- Stop('BlowAnim')
- if BlowSound then BlowSound:Stop() end
- end
- Tool.Equipped:connect(OnEquipped)
- Tool.Activated:connect(OnActivated)
- Tool.Unequipped:connect(OnUnequipped)
- end))
- Script5.Name = "EnableScript"
- Script5.Parent = LocalScript4
- Script5.Disabled = true
- table.insert(cors,sandbox(Script5,function()
- local TIME_UNTIL_ENABLED = 1
- wait(TIME_UNTIL_ENABLED)
- if script.Parent then
- script.Parent.Enabled = true
- end
- script:Destroy()
- end))
- Script6.Name = "MotorizeRightGrip"
- Script6.Parent = LocalScript4
- table.insert(cors,sandbox(Script6,function()
- -- stravant's AnimEdit helper, to make sure tools actually animate.
- function Create(ty)
- return function(data)
- local obj = Instance.new(ty)
- for k, v in pairs(data) do
- if type(k) == 'number' then
- v.Parent = obj
- else
- obj[k] = v
- end
- end
- return obj
- end
- end
- local Tool = script.Parent.Parent
- local armChildRemovedConn = nil
- local Motor6DGrip = nil
- local EquippedNum = 0
- Tool.Equipped:connect(function()
- EquippedNum = EquippedNum + 1
- local myEquip = EquippedNum
- --some vars
- local Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
- local Character = Player.Character
- local rightarm = Character:FindFirstChild('Right Arm')
- if rightarm and rightarm:FindFirstChild('RightGrip') then
- local rightGrip = rightarm['RightGrip']
- local handle = rightGrip.Part1
- --kill my joint when the normal joint is removed
- --this must be done here so that the joint is removed
- --_right away_ after unequipping and the character doesn't
- --glitch up.
- local armChildRemovedConn = rightarm.ChildRemoved:connect(function(ch)
- if ch == rightGrip then
- Motor6DGrip:Remove()
- Motor6DGrip = nil
- --
- if handle and Character:FindFirstChild('Torso') then
- if Tool.Parent.Parent:IsA('Player') then
- --the sword has been deselected
- --put the sword far away so the user doesn't notice that the handle doesn't
- --update for about 0.1 seconds after selecting the tool.
- handle.CFrame = CFrame.new(100000, 100000, 100000)
- else
- --if in the workspace, position the handle where it should be dropped
- --use the size of the handle to make sure it's dropped far enough away
- handle.CFrame = Character.Torso.CFrame * CFrame.new(0, 0, -(handle.Size.magnitude+2))
- end
- end
- end
- end)
- --make my new joint
- Motor6DGrip = Create'Motor6D'{
- Name = 'RightGrip_Motor';
- Part0 = rightarm;
- Part1 = handle;
- C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0); -- from original right grip
- C1 = CFrame.new(0.1, -0.6, 0.4, 1, 0, 0, 0, 0, -1, 0, 1, 0);
- }
- --kill the old weld
- rightGrip.Part1 = nil
- rightGrip.Part0 = nil
- Motor6DGrip.Parent = rightGrip.Parent
- end
- end)
- Tool.Unequipped:connect(function()
- EquippedNum = EquippedNum + 1
- if armChildRemovedConn then
- armChildRemovedConn:disconnect()
- armChildRemovedConn = nil
- end
- end)
- end))
- Animation7.Name = "BlowAnim"
- Animation7.Parent = Tool0
- Animation7.AnimationId = "http://www.roblox.com/asset?id=127405384"
- Script8.Name = "TornadoScript"
- Script8.Parent = Tool0
- Script8.Disabled = true
- table.insert(cors,sandbox(Script8,function()
- --
- local Tornado = script.Parent
- local IgnoreChar = Tornado:WaitForChild('Ignore').Value
- local PartInfo = {}
- local StuffToDestroy = {}
- local bpTable = {}
- local startRadTable = {}
- local NUM_STEPS = 100
- local STEP_TIME = 5.1
- -- Copied from HotThoth's code for the Tornade. SECRET RETEXTURE MUWAHAHAHA
- Tornado.Touched:connect(function(part)
- if part.Parent and part.Parent ~= IgnoreChar then
- if part.Parent.Parent and part.Parent.Parent == IgnoreChar then -- check for initiating character's hat
- return
- end
- part:BreakJoints()
- local spinForce = part:FindFirstChild('KOSSGustTornadoSpin')
- if spinForce == nil then
- local spinForce = Instance.new('BodyAngularVelocity')
- spinForce.P = 1000000
- spinForce.angularvelocity = Vector3.new(0,50,0)
- spinForce.maxTorque = Vector3.new(spinForce.P,spinForce.P,spinForce.P)
- spinForce.Name = 'KOSSGustTornadoSpin'
- spinForce.Parent = part
- table.insert(StuffToDestroy, spinForce)
- end
- local newBV = part:FindFirstChild('KOSSGustTornadoLift')
- if newBV == nil then
- newBV = Instance.new("BodyVelocity")
- newBV.Name = 'KOSSGustTornadoLift'
- newBV.P = 100000
- newBV.maxForce = Vector3.new(0, newBV.P, 0)
- newBV.velocity = Vector3.new(0, 16, 0)
- newBV.Parent = part
- table.insert(StuffToDestroy, newBV)
- end
- local newBP = part:FindFirstChild('KOSSGustTornadoPos')
- if newBP == nil then
- newBP = Instance.new("BodyPosition")
- newBP.Name = 'KOSSGustTornadoPos'
- newBP.P = 100000
- newBP.maxForce = Vector3.new(newBP.P, 0, newBP.P)
- newBP.position = part.Position
- newBP.Parent = part
- table.insert(bpTable, newBP)
- table.insert(startRadTable, (part.Position - Tornado.Position)*Vector3.new(1, 0, 1))
- table.insert(StuffToDestroy, newBP)
- end
- end
- end)
- for i = 1, NUM_STEPS do
- for i = 1, #bpTable do
- bpTable[i].position = Tornado.Position + startRadTable[i]
- startRadTable[i] = CFrame.Angles(0, .7, 0)*startRadTable[i]
- end
- wait(STEP_TIME)
- end
- for _, thing in pairs(StuffToDestroy) do
- thing:Destroy()
- end
- Tornado:Destroy()
- --
- end))
- LocalScript9.Name = "Local Gui"
- LocalScript9.Parent = Tool0
- table.insert(cors,sandbox(LocalScript9,function()
- Tool = script.Parent
- local stillEquipped = false
- function onEquippedLocal(mouse)
- stillEquipped = true
- if mouse == nil then
- print("Mouse not found")
- return
- end
- while stillEquipped do
- print("Setting Mouse to go")
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- while Tool.Enabled and stillEquipped do
- wait(0.01)
- end
- print("Setting Mouse to wait")
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- while not Tool.Enabled and stillEquipped do
- wait(0.01)
- end
- end
- end
- function onUnequippedLocal()
- stillEquipped = false
- end
- Tool.Equipped:connect(onEquippedLocal)
- Tool.Unequipped:connect(onUnequippedLocal)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement