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
- script.Parent = workspace.CurrentCamera
- local plr = game:GetService("Players").LocalPlayer
- local tool = Instance.new("Tool",plr:WaitForChild("Backpack"))
- tool.Grip = CFrame.new(0,-0.2,-1.6) * CFrame.Angles(math.rad(100),math.rad(180),math.rad(0))
- tool.Name = "bluE"
- local part = Instance.new("Part",tool)
- part.Name = "Handle"
- part.Size = Vector3.new(4,6,4)
- part.TopSurface = "Smooth"
- part.BottomSurface = "Smooth"
- part.CanCollide = false
- part:BreakJoints()
- local mesh = Instance.new("SpecialMesh",part)
- mesh.MeshId = "rbxassetid://24342877" --mesh.MeshId = "rbxassetid://132920499"
- mesh.TextureId = "rbxassetid://139521211" --"http://www.roblox.com/asset/?id=134479421"
- mesh.Scale = Vector3.new(2,2,2)
- local sound = Instance.new("Sound",part)
- sound.SoundId = "rbxassetid://148862502"
- sound.Volume = 10
- local sound2 = Instance.new("Sound",part)
- sound2.SoundId = "rbxassetid://280667448"
- sound2.Volume = 5
- local sound3 = Instance.new("Sound",part)
- sound3.SoundId = "rbxassetid://198973822"
- sound3.Volume = 10
- local sound4 = Instance.new("Sound",part)
- sound4.SoundId = "rbxassetid://258057783"
- sound4.Volume = 10
- local sound5 = Instance.new("Sound",part)
- sound5.SoundId = "rbxassetid://130932305"
- sound5.Volume = 10
- local sound6 = Instance.new("Sound",part)
- sound6.SoundId = "rbxassetid://906084456"
- sound6.Volume = 10
- sound6.TimePosition = 2
- function firstHum(target)
- for i,v in pairs(target:GetChildren()) do
- if v:IsA("Humanoid") then
- return v
- end
- end
- return nil
- end
- local slap = false
- local cd = false
- plr:GetMouse().Button1Down:connect(function()
- if tool.Parent == plr.Character then
- if slap == false then
- slap = true
- sound2:Play()
- local str = Instance.new("StringValue")
- str.Name = "toolanim"
- str.Value = "Slash"
- str.Parent = tool
- wait(1)
- slap = false
- end
- end
- end)
- part.Touched:connect(function(hit)
- if slap == true then
- if cd == false then
- if not hit:IsDescendantOf(plr.Character) then
- if hit.Parent:IsA("Model") then
- local fhum = firstHum(hit.Parent)
- if fhum then
- cd = true
- fhum.PlatformStand = true
- sound:Play()
- local con1
- con1 = game:GetService("RunService").Heartbeat:connect(function()
- fhum.PlatformStand = true
- end)
- wait(0.1)
- local vel = Instance.new("BodyVelocity",hit)
- vel.Velocity = ((hit.Position - plr.Character:WaitForChild("HumanoidRootPart").Position).unit + Vector3.new(0,0.5,0))*50
- vel.MaxForce = Vector3.new(10000000,10000000,10000000)
- wait(1)
- cd = false
- vel:Destroy()
- local vel2 = Instance.new("BodyVelocity",hit)
- vel2.Velocity = Vector3.new(0,12.5,0)
- vel2.MaxForce = Vector3.new(10000000,10000000,10000000)
- local p2 = Instance.new("Part",hit)
- p2.Anchored = true
- p2.Transparency = 0.6
- p2.CanCollide = false
- p2.Size = Vector3.new(0.2,0.2,0.2)
- p2.CFrame = CFrame.new(hit.CFrame.p) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))
- p2.BrickColor = BrickColor.new("New Yeller")
- p2.Material = "Neon"
- local m2 = Instance.new("CylinderMesh",p2)
- m2.Scale = Vector3.new(60,10000,60)
- local scln = sound3:Clone()
- scln.Parent = hit
- scln:Play()
- local con2
- con2 = game:GetService("RunService").Heartbeat:connect(function()
- p2.CFrame = CFrame.new(hit.CFrame.p) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))
- end)
- wait(7)
- vel2.Velocity = Vector3.new(0,0,0)
- wait(0.5)
- scln:Stop()
- local scln3 = sound5:Clone()
- scln3.Parent = hit
- scln3:Play()
- wait(1)
- local bav = Instance.new("BodyAngularVelocity",hit)
- bav.AngularVelocity = Vector3.new(math.random(0,360),math.random(0,360),math.random(0,360))
- vel2.Velocity = Vector3.new(0,-250,0)
- p2.BrickColor = BrickColor.new("Really red")
- local scln6 = sound6:Clone()
- scln6.Parent = hit
- scln6:Play()
- local continue = false
- local htc
- htc = hit.Touched:connect(function(hitp)
- if not hitp:IsDescendantOf(hit.Parent) then
- continue = true
- scln6:Stop()
- vel2:Destroy()
- con2:Disconnect()
- con1:Disconnect()
- htc:Disconnect()
- p2:Destroy()
- end
- end)
- repeat wait() until continue == true
- local ctab = {}
- for i=1,4 do
- local p = Instance.new("Part",hit)
- p.Size = Vector3.new(30,30,30)
- p.Anchored = true
- p.CanCollide = false
- p.TopSurface = "Smooth"
- p.BottomSurface = "Smooth"
- p.Color = Color3.fromRGB(255,math.random(0,255),0)
- p.CFrame = hit.CFrame
- local con
- con = game:GetService("RunService").Heartbeat:connect(function()
- p.CFrame = p.CFrame * CFrame.Angles(math.rad(math.random(0,360)),math.rad(math.random(0,360)),math.rad(math.random(0,360)))
- p.Transparency = p.Transparency + 0.01
- if p.Transparency >= 1 then
- con:Disconnect()
- end
- end)
- table.insert(ctab,con)
- end
- Instance.new("Explosion",workspace).Position = hit.Position
- local scln2 = sound4:Clone()
- scln2.Parent = hit
- scln2:Play()
- vel2:Destroy()
- hit.Parent:BreakJoints()
- repeat wait() until not hit:IsDescendantOf(workspace)
- con2:Disconnect()
- end
- end
- end
- end
- end
- end)
Add Comment
Please, Sign In to add comment