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 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
- --Instant Dubstep gun (main code)
- warn(".id (assetid) : change sound id to something \n.vol (volume) : change volume to desired value")
- local function NewPart(prnt)local p=Instance.new("Part");p.Parent=(prnt or nil) return p end
- sound=nil local range=4000 local stype=script.ClassName
- owner=owner or game:service'Players'.tomonaoboys
- local tool=Instance.new("Tool",owner:FindFirstChildOfClass("Backpack"))
- tool.Name="DubStepGun2"hold=false tool.RequiresHandle=nil sound=nil
- ID="130768080"local part=nil local pos=CFrame.new(0,0,0)local oldp=pos local MotBLaser=false local RES=10
- local Handle=Instance.new("Part",tool)Handle.Name="Handle"Handle.CanCollide=false
- local equip=false local Effects=Instance.new("Folder",workspace)
- local time=0 local Vol=1
- local PL=owner
- local function FindHumanoid(Part)local humanoid=nil if Part.Parent then if Part.Parent~=PL.Character and Part.Parent:FindFirstChildOfClass("Humanoid")~=nil then humanoid=Part.Parent:FindFirstChildOfClass("Humanoid")else if Part.Parent.Parent then if Part.Parent.Parent:FindFirstChildOfClass("Humanoid")and Part.Parent.Parent~=PL.Character then humanoid=Part.Parent.Parent:FindFirstChildOfClass("Humanoid")end end end end return humanoid end
- local KILLTEXT="This player was killed by insanely huge ear rip loud sound."
- local w=function(t)
- if t then for i=1,t do game:service'RunService'.Heartbeat:wait()end
- else game:service'RunService'.Heartbeat:wait()
- end return 1 end
- local Col=Color3.new(1)
- local Mouse = PL:GetMouse()
- tool.Equipped:connect(function()
- equip=true
- hold=nil
- tool.Activated:connect(function()hold=1 end)
- tool.Deactivated:connect(function()hold=nil end)
- while w()and equip do
- if Mouse and equip then oldp=pos pos=Mouse.Hit end -- if stype~="Script"then end
- if owner:FindFirstChild"MousePointCF"then oldp=pos pos=owner.MousePointCF.Value
- end
- end
- end)
- tool.Unequipped:connect(function()equip=false hold=nil end)
- owner.Chatted:connect(function(m)
- if m:sub(1,3)==".id"then ID=tostring(m:sub(4))print("id set to : "..tostring(m:sub(4)))time=0 end
- if m:sub(1,4)==".vol"then Vol=tonumber(m:sub(5))print("vol set to : "..tostring(m:sub(5)))end
- if m:sub(1,8)==".MotionB"then MotBLaser=not MotBLaser end
- if m:sub(1,5)==".MRES"then RES=tonumber(m:sub(6))or RES end
- end)
- game:service'RunService'.Heartbeat:connect(function()
- if not Effects.Parent then Effects=Instance.new("Folder",workspace) end Effects:ClearAllChildren()
- if hold then
- local h,p=workspace:FindPartOnRayWithIgnoreList(Ray.new(Handle.CFrame.p,CFrame.new(Handle.CFrame.p,pos.p).lookVector*range),{owner.Character,Effects},nil,1)
- if (p-Handle.CFrame.p).magnitude<2000 then
- pcall(function()
- if not MotBLaser then -- Instance.new("Part",owner.Character)
- local part=NewPart(owner.Character) part.Material="ForceField"part.CanCollide=false part.Anchored=true
- local mesh=Instance.new("BlockMesh",part)part.Size=Vector3.new(.5,.5,(p-Handle.CFrame.p).magnitude)
- mesh.Scale=part.Size*1000 part.Size=Vector3.new()part.Color=Col
- part.CFrame=CFrame.new(Handle.CFrame.p,p)*CFrame.new(0,0,-(p-Handle.CFrame.p).magnitude/2)
- spawn(function()for i=0,1,.2 do part.Transparency=i w()end part:Destroy()end)
- else
- local h2,p2=workspace:FindPartOnRayWithIgnoreList(Ray.new(Handle.CFrame.p,CFrame.new(Handle.CFrame.p,oldp.p).lookVector*range),{owner.Character,Effects},nil,1)
- for i=0,1,1/RES do --Instance.new("Part",Effects)
- local part=NewPart(Effects) part.Material="Neon"part.CanCollide=false part.Anchored=true
- local mesh=Instance.new("BlockMesh",part)part.Size=Vector3.new(.5,.5,((p:lerp(p2,i))-Handle.CFrame.p).magnitude)
- mesh.Scale=part.Size*1000 part.Size=Vector3.new()part.Color=Col
- part.CFrame=CFrame.new(Handle.CFrame.p,p:lerp(p2,i))*CFrame.new(0,0,-((p:lerp(p2,i))-Handle.CFrame.p).magnitude/2)
- part.Transparency=i
- end
- end
- end)end
- if h then local hu=FindHumanoid(h)
- if hu then
- if hu.MaxHealth==1/0 or hu.Health==1/0 then hu.MaxHealth=100 hu.Health=.5 end
- local dmg=hu.MaxHealth/100
- if hu.Health-dmg<=0 and hu.Health>0 then if hu.Parent then hu.Parent:BreakJoints()end hu.Health=0 print("rip")
- pcall(function()local pa=Instance.new("Part",workspace)pa.Transparency=1 pa.Size=Vector3.new()pa.CFrame=CFrame.new(p)pa.Anchored=1
- local b=Instance.new("BillboardGui",pa)b.AlwaysOnTop=1 b.Size=UDim2.new(64,0,5,0)
- local t=Instance.new("TextBox",b)t.Text=KILLTEXT
- t.BackgroundTransparency=1 t.TextScaled=1 t.Size=UDim2.new(1,0,1,0)
- t.TextStrokeTransparency=0 t.TextColor3=Color3.new(1,1,1)spawn(function()for i=0,1,.005 do t.TextTransparency=i t.TextStrokeTransparency=i w()end pa:Destroy()end)end)end hu.Health=hu.Health-dmg
- end end --Instance.new("Part",owner.Character)
- local part=NewPart(owner.Character) part.Material="Neon"part.CanCollide=false part.Anchored=true
- local mesh=Instance.new("BlockMesh",part)part.Size=Vector3.new(2,2,2)
- mesh.Scale=part.Size*1000 part.Size=Vector3.new()part.Color=Col
- part.CFrame=CFrame.new(p)*CFrame.Angles(math.rad(math.random(360)),math.rad(math.random(360)),0)
- spawn(function()for i=0,1,.05 do part.Transparency=i w()end part:Destroy()end)
- if not sound then sound=Instance.new("Sound",Handle)sound.TimePosition=time sound.Looped=1 sound.SoundId="rbxassetid://"..ID sound.Volume=Vol sound:Play()else time=sound.TimePosition end
- else
- if sound then sound:Destroy()sound=nil end
- end
- end)
Add Comment
Please, Sign In to add comment