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,Mouse,mouse,UserInputService,ContextActionService = owner
- do
- print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
- script.Parent = Player.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,Connect=function(self,f)self.Function=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()}
- 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 and t.Function then
- t.Function(...)
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=Player then return end
- if io.isMouse then
- m.Target = io.Target
- m.Hit = io.Hit
- else
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- 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 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})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local Mouse = Player:GetMouse()
- 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)
- Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
- end
- local BP = Instance.new("BodyPosition", owner.Character)
- BP.Name = "FlyPosition"
- BP.maxForce = Vector3.new(0, math.huge, 0)
- if owner.Character:FindFirstChild("LeftFoot") == true then
- BP.position = owner.Character.LowerTorso.Position
- else
- BP.position = owner.Character.Torso.Position
- end
- Character = owner.Character
- size = {
- NumberSequenceKeypoint.new(0,1,0),
- NumberSequenceKeypoint.new(1,2,1)
- }
- sees = {
- NumberSequenceKeypoint.new(0,1,0),
- NumberSequenceKeypoint.new(0.45,0.75,0),
- NumberSequenceKeypoint.new(0.55,0.75,0),
- NumberSequenceKeypoint.new(1,1,0)
- }
- ParticleEmitter1 = Instance.new("ParticleEmitter")
- ParticleEmitter1.Name = "Cloud"
- if Character:FindFirstChild("LeftFoot") == true then
- ParticleEmitter1.Parent = Character.LeftFoot
- else
- ParticleEmitter1.Parent = Character["Left Leg"]
- end
- ParticleEmitter1.Speed = NumberRange.new(2.5,5)
- ParticleEmitter1.Rotation = NumberRange.new(-180,180)
- ParticleEmitter1.Color = ColorSequence.new(Color3.fromRGB(255,255,255))
- ParticleEmitter1.Enabled = false
- ParticleEmitter1.LightEmission = 0
- ParticleEmitter1.LockedToPart = true
- ParticleEmitter1.Texture = "http://www.roblox.com/asset/?id=258128463"
- ParticleEmitter1.Transparency = NumberSequence.new(sees)
- ParticleEmitter1.ZOffset = 1
- ParticleEmitter1.Size = NumberSequence.new(size)
- ParticleEmitter1.EmissionDirection = Enum.NormalId.Bottom
- ParticleEmitter1.Lifetime = NumberRange.new(1,2)
- ParticleEmitter1.Rate = 100
- ParticleEmitter1.RotSpeed = NumberRange.new(0)
- ParticleEmitter1.Acceleration = Vector3.new(0,10,0)
- ParticleEmitter1.SpreadAngle = Vector2.new(50,50)
- ParticleEmitter1.VelocitySpread = 0
- ParticleEmitter2 = Instance.new("ParticleEmitter")
- ParticleEmitter2.Name = "Cloud"
- if Character:FindFirstChild("LeftFoot") == true then
- ParticleEmitter2.Parent = Character.RightFoot
- else
- ParticleEmitter2.Parent = Character["Right Leg"]
- end
- ParticleEmitter2.Speed = NumberRange.new(2.5,5)
- ParticleEmitter2.Rotation = NumberRange.new(-180,180)
- ParticleEmitter2.Color = ColorSequence.new(Color3.fromRGB(255,255,255))
- ParticleEmitter2.Enabled = false
- ParticleEmitter2.LightEmission = 0
- ParticleEmitter2.Texture = "http://www.roblox.com/asset/?id=258128463"
- ParticleEmitter2.Transparency = NumberSequence.new(sees)
- ParticleEmitter2.ZOffset = 1
- ParticleEmitter2.LockedToPart = true
- ParticleEmitter2.Size = NumberSequence.new(size)
- ParticleEmitter2.EmissionDirection = Enum.NormalId.Bottom
- ParticleEmitter2.Lifetime = NumberRange.new(1,2)
- ParticleEmitter2.Rate = 100
- ParticleEmitter2.RotSpeed = NumberRange.new(0)
- ParticleEmitter2.SpreadAngle = Vector2.new(-360,360)
- ParticleEmitter2.VelocitySpread = 0
- ParticleEmitter1.Acceleration = Vector3.new(0,1,0)
- ParticleEmitter1.SpreadAngle = Vector2.new(50,50)
- ParticleEmitter2.Acceleration = Vector3.new(0,1,0)
- ParticleEmitter2.SpreadAngle = Vector2.new(50,50)
- flying = false
- Mouse.KeyDown:Connect(function(k)
- if k == "z" then
- if flying == false then
- flying = true
- ParticleEmitter1.Enabled = true
- ParticleEmitter2.Enabled = true
- owner.Character.Humanoid.WalkSpeed = 100
- if owner.Character:FindFirstChild("LeftFoot") == true then
- BP.Parent = owner.Character.LowerTorso
- BP.position = owner.Character.LowerTorso.Position
- else
- BP.Parent = owner.Character.Torso
- BP.position = owner.Character.Torso.Position
- end
- elseif flying == true then
- flying = false
- ParticleEmitter1.Enabled = false
- ParticleEmitter2.Enabled = false
- owner.Character.Humanoid.WalkSpeed = 16
- BP.Parent = owner.Character
- end
- end
- if k == "q" and flying == true then
- BP.Position = BP.Position + Vector3.new(0,20,0)
- elseif k == "e" and flying == true then
- BP.Position = BP.Position - Vector3.new(0,20,0)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement