Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- 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 V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- 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 TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(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
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled 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 every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true 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
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __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 RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame: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(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- local oldtick = tick()
- warn("Omae Wa Mou Shinderu")
- local plr = game:GetService("Players").LocalPlayer
- local char, mouse = plr.Character, plr:GetMouse()
- local hitTab = {}
- local fadeTab = {}
- local spd = 0.2 * char:FindFirstChild("Humanoid").WalkSpeed / 16
- local sound1 = Instance.new("Sound", char.HumanoidRootPart)
- local sound2 = Instance.new("Sound", char.HumanoidRootPart)
- local sound3 = Instance.new("Sound")
- sound1.SoundId = "rbxassetid://130767866"
- sound1.Volume = 10
- sound2.SoundId = "rbxassetid://142684400"
- sound2.Volume = 10
- sound3.SoundId = "rbxassetid://985132972"
- sound3.Volume = 10
- local particle = Instance.new("ParticleEmitter")
- particle.LightEmission = 0.2
- particle.Texture = "rbxassetid://50263573"
- particle.Size = NumberSequence.new({
- NumberSequenceKeypoint.new(0, 0),
- NumberSequenceKeypoint.new(0.5, 1),
- NumberSequenceKeypoint.new(1, 0)
- })
- particle.Acceleration = Vector3.new(0, 0, 0)
- particle.Lifetime = NumberRange.new(0.15, 0.3)
- particle.Rate = 50
- particle.Rotation = NumberRange.new(0, 360)
- particle.RotSpeed = NumberRange.new(0, 0)
- particle.Speed = NumberRange.new(0, 0)
- local dfj = {}
- char:WaitForChild("Animate"):Destroy()
- char:WaitForChild("Humanoid"):WaitForChild("Animator"):Destroy()
- for i, v in pairs(char:FindFirstChild("Torso"):GetChildren()) do
- if v:IsA("Motor6D") and v.Name ~= "Neck" then
- table.insert(dfj, v:Clone())
- v:Destroy()
- end
- end
- local state = "idle"
- local rootpart = char:FindFirstChild("HumanoidRootPart")
- local rootjoint = rootpart:FindFirstChild("RootJoint")
- rootjoint.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180))
- local rarm = Instance.new("Weld", char:FindFirstChild("Right Arm") or nil)
- rarm.Part0 = char:FindFirstChild("Torso") or nil
- rarm.Part1 = char:FindFirstChild("Right Arm") or nil
- rarm.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- rarm.C1 = CFrame.new(-0.5, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- local larm = Instance.new("Weld", char:FindFirstChild("Left Arm") or nil)
- larm.Part0 = char:FindFirstChild("Torso") or nil
- larm.Part1 = char:FindFirstChild("Left Arm") or nil
- larm.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- larm.C1 = CFrame.new(0.5, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- local rleg = Instance.new("Weld", char:FindFirstChild("Right Leg") or nil)
- rleg.Part0 = char:FindFirstChild("Torso") or nil
- rleg.Part1 = char:FindFirstChild("Right Leg") or nil
- rleg.C0 = CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- rleg.C1 = CFrame.new(0.5, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- local lleg = Instance.new("Weld", char:FindFirstChild("Left Leg") or nil)
- lleg.Part0 = char:FindFirstChild("Torso") or nil
- lleg.Part1 = char:FindFirstChild("Left Leg") or nil
- lleg.C0 = CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- lleg.C1 = CFrame.new(-0.5, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- local neck = char:FindFirstChild("Torso"):FindFirstChild("Neck") or nil
- neck.Part0 = char:FindFirstChild("Torso") or nil
- neck.Part1 = char:FindFirstChild("Head") or nil
- neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- neck.C1 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- function hitSphere()
- local function recSearch(par)
- local tab = {}
- local function rec(parent)
- if parent:IsA("Humanoid") and parent ~= char:FindFirstChildOfClass("Humanoid") then
- table.insert(tab, parent)
- end
- for i, v in pairs(parent:GetChildren()) do
- rec(v)
- end
- end
- rec(par)
- return tab
- end
- local humsFound = {}
- for i, v in pairs(recSearch(workspace)) do
- table.insert(humsFound, v)
- end
- return humsFound
- end
- mouse.Button1Down:connect(function()
- if state ~= "busy" then
- state = "busy"
- do
- local foundHums = {}
- local prtcls = {}
- local sounds = {}
- local parts = {}
- sound1:Play()
- local hit = false
- local toggle = false
- local frmcon
- local frame = 0
- frmcon = game:service("RunService").RenderStepped:connect(function()
- frame = frame + 1
- if frame / 4 == math.floor(frame / 4) then
- if toggle == false then
- toggle = true
- else
- toggle = false
- end
- end
- if toggle == true then
- rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(45)), spd * 1.5)
- larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(90)), spd * 1.5)
- rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(225)), spd * 1.5)
- neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-45), math.rad(0)), spd * 1.5)
- else
- rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(-90)), spd * 1.5)
- larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(-45)), spd * 1.5)
- rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(135)), spd * 1.5)
- neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(45), math.rad(0)), spd * 1.5)
- end
- if frame % 5 == 0 then
- for i, v in pairs(hitSphere()) do
- for o, b in pairs(v.Parent:GetChildren()) do
- if b:IsA("BasePart") and 4 >= (b.Position - rootjoint.Parent.CFrame * CFrame.new(0, 0, -2.25).p).Magnitude then
- hit = true
- if foundHums[v] then
- foundHums[v] = foundHums[v] + 1
- else
- foundHums[v] = 1
- local ns = sound3:Clone()
- ns.Parent = b
- table.insert(sounds, ns)
- end
- if not prtcls[b] then
- partClone = particle:Clone()
- partClone.Enabled = false
- partClone.Parent = b
- prtcls[b] = partClone
- end
- local p = Instance.new("Part")
- p.Size = Vector3.new(0.2, 0.2, 0.2)
- p.Color = Color3.new(1, 1, 1)
- p.TopSurface = "Smooth"
- p.BottomSurface = "Smooth"
- p.Anchored = true
- p.CanCollide = false
- p.Shape = "Ball"
- p.CFrame = CFrame.new(b.CFrame.p + Vector3.new(math.random(-10, 10) / 10, math.random(-10, 10) / 10, math.random(-10, 10) / 10))
- p.Parent = workspace
- table.insert(fadeTab, p)
- parts[b] = b
- end
- end
- end
- end
- end)
- local bucon
- bucon = mouse.Button1Up:connect(function()
- frmcon:disconnect()
- sound1:Stop()
- state = "idle"
- if hit == true then
- sound2:Play()
- wait(2.7)
- for i, v in pairs(sounds) do
- spawn(function()
- wait(math.random(0, 100) / 600)
- v.TimePosition = 2.5
- v:Play()
- end)
- end
- wait(1.2)
- for i, v in pairs(prtcls) do
- v.Enabled = true
- end
- wait(1.3)
- spawn(function()
- local rcon
- local frame = 0
- rcon = game:service("RunService").RenderStepped:connect(function()
- frame = frame + 1
- for i, v in pairs(sounds) do
- v.Volume = 10 - frame / 5
- if v.Volume <= 0 then
- v.Volume = 0
- v:Destroy()
- end
- end
- if frame >= 200 then
- for i, v in pairs(sounds) do
- v:Destroy()
- end
- end
- end)
- end)
- for i, v in pairs(parts) do
- v.RotVelocity = Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
- v.Velocity = v.Velocity + Vector3.new(0, 20, 0)
- local bvel = Instance.new("BodyVelocity", v)
- bvel.MaxForce = Vector3.new(1000000, 1000000, 1000000)
- bvel.Velocity = Vector3.new(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
- game:service("Debris"):AddItem(bvel, 0.5)
- end
- for i, v in pairs(foundHums) do
- if i.MaxHealth >= math.huge then
- i.MaxHealth = 100
- end
- i.Health = 0
- end
- wait(0.7)
- for i, v in pairs(prtcls) do
- v.Enabled = false
- end
- end
- bucon:disconnect()
- end)
- end
- end
- end)
- game:GetService("RunService").Heartbeat:connect(function()
- for i, v in pairs(fadeTab) do
- v.Transparency = v.Transparency + 0.1
- local savecf = v.CFrame
- v.Size = v.Size + Vector3.new(0.3, 0.3, 0.3)
- v.CFrame = savecf
- end
- local isub = 0
- for i = 1, #fadeTab do
- if fadeTab[i - isub].Transparency >= 1 then
- fadeTab[i - isub]:Destroy()
- table.remove(fadeTab, i - isub)
- isub = isub + 1
- end
- end
- char:FindFirstChild("Humanoid").WalkSpeed = 26
- spd = 0.2 * char:FindFirstChild("Humanoid").WalkSpeed / 16
- if state ~= "busy" then
- local ray = Ray.new(rootpart.Position, Vector3.new(0, -4, 0))
- local part, pos, normal = workspace:FindPartOnRayWithIgnoreList(ray, char:GetChildren(), false, true)
- if rootpart.Velocity.Magnitude > 0.5 and part ~= nil then
- state = "running"
- elseif rootpart.Velocity.Magnitude <= 0.5 and part ~= nil then
- state = "idle"
- elseif 0 < rootpart.Velocity.Y and part == nil then
- state = "jumping"
- elseif 0 >= rootpart.Velocity.Y and part == nil then
- state = "falling"
- end
- if state == "idle" then
- rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5 + math.cos(tick() + 0.5) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad((math.cos(tick()) + 1) / 16) * 20), spd)
- larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5 + math.cos(tick() + 0.5) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-(math.cos(tick()) + 1) / 16) * 20), spd)
- rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd)
- neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- elseif state == "running" then
- rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - -math.sin(tick() * 8 + 90) / 8, math.sin(tick() * 8 + 90) / 10) * CFrame.Angles(math.rad(math.sin(tick() * 8) * 60), math.rad(0), math.rad(0)), spd)
- lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.sin(tick() * 8 + 90) / 8, -math.sin(tick() * 8 + 90) / 10) * CFrame.Angles(-math.rad(math.sin(tick() * 8) * 60), math.rad(0), math.rad(0)), spd)
- rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(math.sin(tick() * 8) * 80), math.rad(0), math.rad(0)), spd)
- larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(-math.rad(math.sin(tick() * 8) * 80), math.rad(0), math.rad(0)), spd)
- rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-110), math.rad(0), math.rad(180)), spd)
- neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), spd)
- elseif state == "jumping" then
- rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd)
- neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- elseif state == "falling" then
- rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd)
- neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd)
- end
- end
- end)
- warn("Loaded! Time elapsed: " .. tick() - oldtick)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement