Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- 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")
- Sound4 = Instance.new("Sound")
- Sound5 = Instance.new("Sound")
- LocalScript6 = Instance.new("LocalScript")
- Animation7 = Instance.new("Animation")
- Animation8 = Instance.new("Animation")
- Tool0.Name = "GravityHammer"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=33685977"
- Tool0.GripPos = Vector3.new(0, -1.20000005, 0.600000024)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Bright blue")
- Part1.Rotation = Vector3.new(-180, -45.2199974, -90)
- Part1.RotVelocity = Vector3.new(-0.00272385264, -2.54290589e-09, -0.00430084066)
- Part1.Velocity = Vector3.new(-0.000151261294, -0.00117295235, 0.00204674504)
- Part1.Locked = true
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(2, 5, 3)
- Part1.CFrame = CFrame.new(-4.19833183, 1.38980305, -58.2337456, -5.96046448e-07, 0.704422891, -0.709780633, 1.00000012, 8.34465027e-07, 1.78813934e-07, 7.74860382e-07, -0.709780633, -0.704422951)
- Part1.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- Part1.Position = Vector3.new(-4.19833183, 1.38980305, -58.2337456)
- Part1.Orientation = Vector3.new(0, -134.779999, 90)
- Part1.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=33685862"
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=33685897"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- Sound3.Name = "Hit"
- Sound3.Parent = Part1
- Sound3.SoundId = "http://www.roblox.com/asset/?id=30172281"
- Sound4.Name = "SendOut"
- Sound4.Parent = Part1
- Sound4.SoundId = "http://www.roblox.com/asset/?id=30172373"
- Sound5.Name = "InitialHit"
- Sound5.Parent = Part1
- Sound5.SoundId = "http://www.roblox.com/asset/?id=30299564"
- LocalScript6.Name = "GravityHammerScript"
- LocalScript6.Parent = Tool0
- table.insert(cors,sandbox(LocalScript6,function()
- local Tool = script.Parent
- local hit = nil
- local out = nil
- local humanoid = nil
- local torso = nil
- local enabled = false
- local connection = nil
- local reload = 5
- local hammerStrength = 30
- local upStrength = 1500
- local children = {}
- local toAffect = {}
- local debris = game:GetService("Debris")
- function onActivated()
- if enabled then
- return
- end
- enabled = true
- if hit ~= nil then
- makeHammerActive()
- hit:Play(0.1,1,1)
- connection = hit.KeyframeReached:connect(sendFlying)
- wait(reload)
- end
- enabled = false
- end
- function makeHammerActive()
- local part = Instance.new("Part")
- part.Transparency = 1
- part.formFactor = 2
- part.Size = Vector3.new(1,0.4,1)
- local fire = Instance.new("Fire")
- fire.Color = Color3.new(155/255,1,206/255)
- fire.SecondaryColor = Color3.new(0,1,1)
- fire.Heat = -5
- fire.Size = 8
- fire.Parent = part
- part.Parent = game.Workspace
- local weld = Instance.new("Weld")
- weld.Part0 = part
- weld.Parent = part
- weld.Part1 = Tool.Handle
- weld.C0 = CFrame.new(0,-4.5,0)
- debris:AddItem(part,1.5)
- end
- function sendFlying(stringframe)
- if stringframe == "sendflying" then
- connection:disconnect()
- Tool.Handle.InitialHit:Play()
- Tool.Handle.Hit:Play()
- children = {}
- recursiveGetChildren(game.Workspace)
- for i = 1, #children do
- if children[i].Anchored == false then
- local dist = Vector3.new(children[i].Position.x - torso.Position.x,children[i].Position.y - torso.Position.y,children[i].Position.z - torso.Position.z)
- if dist.magnitude <= hammerStrength then
- local bodyPos = Instance.new("BodyPosition")
- local height = hammerStrength * (1 - (dist.magnitude/hammerStrength))
- bodyPos.position = children[i].Position + Vector3.new(0,height,0)
- bodyPos.P = children[i]:GetMass() * upStrength
- bodyPos.D = bodyPos.P/2
- bodyPos.maxForce = Vector3.new(bodyPos.P,bodyPos.P,bodyPos.P)
- bodyPos.Parent = children[i]
- debris:AddItem(bodyPos,3)
- if children[i].Parent:FindFirstChild("Humanoid") == nil and children[i].Parent.Parent:FindFirstChild("Humanoid") == nil then
- children[i]:BreakJoints()
- end
- table.insert(toAffect,children[i])
- end
- end
- end
- end
- wait(3.1)
- sendOut()
- toAffect = {}
- end
- function sendForceFieldOut()
- local fire = Instance.new("Fire")
- fire.Color = Color3.new(155/255,1,206/255)
- fire.SecondaryColor = Color3.new(0,1,1)
- fire.Heat = -5
- fire.Size = 1
- fire.Parent = torso
- for i = 1, 8 do
- fire.Size = fire.Size + 4
- wait(0.2)
- end
- fire:remove()
- end
- function sendOut()
- if #toAffect > 0 then
- Tool.Handle.SendOut:Play()
- local co = coroutine.create(sendForceFieldOut)
- coroutine.resume(co)
- out:Play()
- out.KeyframeReached:connect(function(string)
- if string == "end" then
- wait(0.4)
- out:Stop()
- end
- end)
- end
- wait(0.3)
- for i =1, #toAffect do
- if toAffect[i].Parent ~= nil and toAffect[i].Parent ~= torso.Parent then
- local dist = Vector3.new(torso.Position.x - toAffect[i].Position.x,torso.Position.y - toAffect[i].Position.y,torso.Position.z - toAffect[i].Position.z)
- local bodyForce = Instance.new("BodyForce")
- bodyForce.force = dist.unit * toAffect[i]:GetMass() * -400
- bodyForce.Parent = toAffect[i]
- if toAffect[i].Parent:FindFirstChild("Humanoid") ~= nil and toAffect[i].Name == "Torso" then
- toAffect[i].Parent:FindFirstChild("Humanoid").Sit = true
- end
- debris:AddItem(bodyForce,1)
- end
- end
- end
- function recursiveGetChildren(parent)
- local kids = parent:GetChildren()
- if kids ~= nil then
- for i =1, #kids do
- if kids[i].className == "Part" then
- table.insert(children,kids[i])
- end
- recursiveGetChildren(kids[i])
- end
- end
- end
- function onEquipped()
- humanoid = Tool.Parent:FindFirstChild("Humanoid")
- torso = Tool.Parent:FindFirstChild("Torso")
- hit = humanoid:LoadAnimation(Tool.gravityslam)
- out = humanoid:LoadAnimation(Tool.staffout)
- end
- function onUnequipped()
- hit:Stop()
- hit:remove()
- out:Stop()
- out:remove()
- end
- Tool.Equipped:connect(onEquipped)
- Tool.Unequipped:connect(onUnequipped)
- Tool.Activated:connect(onActivated)
- end))
- Animation7.Name = "gravityslam"
- Animation7.Parent = Tool0
- Animation7.AnimationId = "http://www.roblox.com/Asset?ID=33169573"
- Animation8.Name = "staffout"
- Animation8.Parent = Tool0
- Animation8.AnimationId = "http://www.roblox.com/Asset?ID=27432686"
- 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