View difference between Paste ID: 0uz5F06Y and metyRL4K
SHOW: | | - or go back to the newest paste.
1
--]]
2
--https://github.com/Mokiros/roblox-FE-compatibility
3
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
4
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
5
local RealPlayer = Player
6
do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
7
8
print("Hold Q to Shoot")
9
laser = nil
10
laserRot = 100
11
pos3 = Vector3.new(0,0,0)
12
counter = 0
13
function chargeLaser3()
14
    local part = Instance.new("Part")  
15
    part.Name = "ChargingLaser3"
16
    game:GetService("Debris"):AddItem(part,1)
17
    part.Parent = game.Players.LocalPlayer.Character
18
    part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
19
    part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
20
    part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
21
    part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines 
22
    part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
23
    part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
24
    part.Material = Enum.Material.Neon
25
    part.Anchored = true
26
    part.CanCollide = false
27
    part.Size = Vector3.new(0.5,0.5,0.5)
28
    local light = math.random(50,150)
29
    local rotx = math.random(-360,360)
30
local roty = math.random(-360,360)
31
local rotz = math.random(-360,360)
32
    part.BrickColor = BrickColor.new('Bright blue')
33
part.Transparency = 0.4
34
part.CFrame = game.Players.LocalPlayer.Character["Right Arm"].CFrame:toWorldSpace(CFrame.new(Vector3.new(0,-1.1,0))) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
35
    for i=0.4,1,0.1 do
36
    wait()
37
    part.Size = Vector3.new(0.5+i,0.5+i,0.5+i)
38
    part.Transparency = i
39
part.CFrame = game.Players.LocalPlayer.Character["Right Arm"].CFrame:toWorldSpace(CFrame.new(Vector3.new(0,-1.1,0))) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
40
end
41
part:remove()
42
end
43
function chargeLaser4()
44
    local part = Instance.new("Part")
45
    game:GetService("Debris"):AddItem(part,1)
46
    part.Name = "ChargingLaser4"
47
    part.Parent = game.Players.LocalPlayer.Character
48
    part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
49
    part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
50
    part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
51
    part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines 
52
    part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
53
    part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
54
    part.Material = Enum.Material.Neon
55
    part.Anchored = true
56
    part.CanCollide = false
57
    part.Size = Vector3.new(2,2,2)
58
    local light = math.random(50,150)
59
    local rotx = math.random(-360,360)
60
local roty = math.random(-360,360)
61
local rotz = math.random(-360,360)
62
    part.BrickColor = BrickColor.new('Bright blue')
63
part.Transparency = 0.4
64
part.CFrame = CFrame.new(pos4) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
65
    for i=0.4,1,0.1 do
66
    wait()
67
    part.Size = Vector3.new(2+i,2+i,2+i)
68
    part.Transparency = i
69
part.CFrame = CFrame.new(pos4) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
70
end
71
part:remove()
72
end
73
 
74
 
75
 
76
 
77
game:GetService("RunService").RenderStepped:connect(function()
78
    counter = counter +1
79
    if counter >= 3 then
80
        counter = 0
81
        chargeLaser3()
82
        if laser ~= nil then
83
            chargeLaser4(pos4)
84
        end
85
    end
86
 
87
    laserRot = laserRot+1
88
    if laser ~= nil then
89
        local pos3 = game.Players.LocalPlayer.Character.ChargingLaser3.Position
90
        pos4 = game.Players.LocalPlayer:GetMouse().Hit.p
91
       
92
        laser.Size = Vector3.new(0.75,0.75,(pos3-pos4).magnitude)
93
        laser.CFrame = CFrame.new((pos3+pos4)/2,pos3)*CFrame.Angles(0,0,math.rad(laserRot))
94
       
95
        local ray = Ray.new(pos3,(pos4-pos3).unit*600)
96
        local hit,position,normal = game.Workspace:FindPartOnRay(ray,game.Players.LocalPlayer.Character)
97
        if hit then
98
       
99
           
100
            hit.Name = "nil"
101
            hit.Material = Enum.Material.Neon
102
 
103
            local c= hit.Color.r+hit.Color.g+hit.Color.b
104
           
105
            c = c*255
106
        c = c/3
107
            hit.BrickColor = BrickColor.new('Bright blue')
108
            hit.Anchored = true
109
       
110
            for _,child in pairs(hit:GetChildren()) do
111
                if child:IsA("BasePart") then
112
                   
113
           
114
                    child.Name = "nil"
115
            child.Material = Enum.Material.Neon
116
                local c= child.Color.r+child.Color.g+child.Color.b
117
       
118
            c = c*255
119
            c = c/3
120
            child.BrickColor = BrickColor.new('Bright blue')
121
       
122
                end
123
                if not child:IsA("BasePart") then
124
                    child:remove()
125
                end
126
            end
127
        end
128
    end
129
end)
130
game:GetService("UserInputService").InputBegan:connect(function(key)
131
    if key.KeyCode == Enum.KeyCode.Q then
132
    game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0*CFrame.Angles(0,0,math.rad(90))
133
    laser = Instance.new("Part")  
134
    laser.Name = "Laser2"
135
    laser.Transparency = 0.25
136
    laser.Parent = game.Players.LocalPlayer.Character
137
    laser.BackSurface = Enum.SurfaceType.SmoothNoOutlines
138
    laser.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
139
    laser.TopSurface = Enum.SurfaceType.SmoothNoOutlines
140
    laser.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
141
    laser.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
142
    laser.RightSurface = Enum.SurfaceType.SmoothNoOutlines
143
    laser.Material = Enum.Material.Neon
144
    laser.Anchored = true
145
    laser.CanCollide = false
146
    laser.Size = Vector3.new(0.75,0.75,0.75)
147
    laser.BrickColor = BrickColor.new('Bright blue')
148
 
149
    end
150
end)
151
game:GetService("UserInputService").InputEnded:connect(function(key)
152
    if key.KeyCode == Enum.KeyCode.Q then
153
    game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0*CFrame.Angles(0,0,math.rad(-90))
154
    laser:remove()
155
    laser = nil
156
    end
157
end)