SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,game,owner = owner,game | |
4 | local RealPlayer = Player | |
5 | do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end | |
6 | ||
7 | --Converted with ttyyuu12345's model to script plugin v4 | |
8 | function sandbox(var,func) | |
9 | local env = getfenv(func) | |
10 | local newenv = setmetatable({},{ | |
11 | __index = function(self,k) | |
12 | if k=="script" then | |
13 | return var | |
14 | else | |
15 | return env[k] | |
16 | end | |
17 | end, | |
18 | }) | |
19 | setfenv(func,newenv) | |
20 | return func | |
21 | end | |
22 | cors = {} | |
23 | mas = Instance.new("Model",game:GetService("Lighting")) | |
24 | Tool0 = Instance.new("Tool") | |
25 | Part1 = Instance.new("Part") | |
26 | SpecialMesh2 = Instance.new("SpecialMesh") | |
27 | LocalScript3 = Instance.new("LocalScript") | |
28 | Part4 = Instance.new("Part") | |
29 | SpecialMesh5 = Instance.new("SpecialMesh") | |
30 | Tool0.Name = "Shotgun" | |
31 | Tool0.Parent = mas | |
32 | Tool0.TextureId = "http://www.roblox.com/asset/?id=19339420" | |
33 | Tool0.GripPos = Vector3.new(0, 0, 0.5) | |
34 | Part1.Name = "Handle" | |
35 | Part1.Parent = Tool0 | |
36 | Part1.BrickColor = BrickColor.new("Black") | |
37 | Part1.Rotation = Vector3.new(0, -90, 0) | |
38 | Part1.FormFactor = Enum.FormFactor.Symmetric | |
39 | Part1.Size = Vector3.new(1, 1, 5) | |
40 | Part1.CFrame = CFrame.new(-6.63999891, 0.500003994, -11.4400177, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
41 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
42 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
43 | Part1.Color = Color3.new(0.105882, 0.164706, 0.207843) | |
44 | Part1.Position = Vector3.new(-6.63999891, 0.500003994, -11.4400177) | |
45 | Part1.Orientation = Vector3.new(0, -90, 0) | |
46 | Part1.Color = Color3.new(0.105882, 0.164706, 0.207843) | |
47 | SpecialMesh2.Parent = Part1 | |
48 | SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=1489994942" | |
49 | SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75) | |
50 | SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=213956852" | |
51 | SpecialMesh2.MeshType = Enum.MeshType.FileMesh | |
52 | SpecialMesh2.Scale = Vector3.new(0.30, 0.30, 0.30) | |
53 | LocalScript3.Name = "Main" | |
54 | LocalScript3.Parent = Tool0 | |
55 | table.insert(cors,sandbox(LocalScript3,function() | |
56 | --Made by Ahtoh13131423144235 | |
57 | --GUN SETTINGS | |
58 | local char=nil--Do not change this | |
59 | local damage=50--Bullet Damage | |
60 | local maxAmmo=9--Max Ammo | |
61 | local clip=9 | |
62 | local ammo=32--Stored Ammo | |
63 | local debounce=true--Do not change this | |
64 | --WELDS | |
65 | local rightArmWeld=nil | |
66 | local leftArmWeld=nil | |
67 | local flameWeld=Instance.new("Weld") | |
68 | flameWeld.Parent=script.Parent.Handle | |
69 | flameWeld.Name="FlameWeld" | |
70 | flameWeld.Part0=script.Parent.Handle | |
71 | flameWeld.Part1=script.Parent.Flame | |
72 | flameWeld.C0=CFrame.new(0,0.3,-3.5)*CFrame.fromEulerAnglesXYZ(0,80.1,0) | |
73 | --ANIMATIONS | |
74 | function equip() | |
75 | for i=1,16 do | |
76 | rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0) | |
77 | leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0) | |
78 | wait() | |
79 | end | |
80 | for i=1,7 do | |
81 | leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0,0,0.1) | |
82 | wait() | |
83 | end | |
84 | for i=1,7 do | |
85 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0,0) | |
86 | wait() | |
87 | end | |
88 | for i=1,15 do | |
89 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0,-0.1,0) | |
90 | wait() | |
91 | end | |
92 | for i=1,7 do | |
93 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0) | |
94 | wait() | |
95 | end | |
96 | end | |
97 | ||
98 | function shoot() | |
99 | for i=1,2 do | |
100 | rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0) | |
101 | leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0) | |
102 | script.Parent.Flame.Transparency=script.Parent.Flame.Transparency-0.4 | |
103 | wait() | |
104 | end | |
105 | for i=1,2 do | |
106 | rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,0) | |
107 | leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,0) | |
108 | script.Parent.Flame.Transparency=script.Parent.Flame.Transparency+0.4 | |
109 | wait() | |
110 | end | |
111 | for i=1,5 do | |
112 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0) | |
113 | wait() | |
114 | end | |
115 | for i=1,5 do | |
116 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0) | |
117 | wait() | |
118 | end | |
119 | end | |
120 | function reload() | |
121 | for i=1,7 do | |
122 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0) | |
123 | wait() | |
124 | end | |
125 | for i=1,14 do | |
126 | leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,-0.1) | |
127 | wait() | |
128 | end | |
129 | wait() | |
130 | for i=1,14 do | |
131 | leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0.1) | |
132 | wait() | |
133 | end | |
134 | for i=1,7 do | |
135 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0) | |
136 | wait() | |
137 | end | |
138 | for i=1,5 do | |
139 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0) | |
140 | wait() | |
141 | end | |
142 | for i=1,5 do | |
143 | leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0) | |
144 | wait() | |
145 | end | |
146 | end | |
147 | --SCRIPT | |
148 | script.Parent.Activated:connect(function() | |
149 | if debounce==false and clip>0 then | |
150 | debounce=true | |
151 | local mouse=game.Players.LocalPlayer:GetMouse() | |
152 | if mouse.Target~=nil then | |
153 | if mouse.Target.Parent:FindFirstChild("Humanoid")~=nil then | |
154 | mouse.Target.Parent.Humanoid.Health=mouse.Target.Parent.Humanoid.Health-damage | |
155 | end | |
156 | end | |
157 | shoot() | |
158 | local shell=Instance.new("Part") | |
159 | shell.Parent=game.Workspace | |
160 | shell.Name="Shell" | |
161 | shell.Size=Vector3.new(0.1,0.2,0.1) | |
162 | shell.Position=script.Parent.Handle.Position+Vector3.new(0.4,0,0) | |
163 | shell.CanCollide=true | |
164 | shell.BrickColor=BrickColor.new("Bright red") | |
165 | local mesh=Instance.new("SpecialMesh") | |
166 | mesh.Parent=shell | |
167 | mesh.MeshType="Head" | |
168 | game.Debris:AddItem(shell,4) | |
169 | clip=clip-1 | |
170 | debounce=false | |
171 | elseif debounce==false and clip<=0 and ammo>0 then | |
172 | debounce=true | |
173 | reload() | |
174 | clip=maxAmmo | |
175 | ammo=ammo-maxAmmo | |
176 | debounce=false | |
177 | end | |
178 | end) | |
179 | script.Parent.Equipped:connect(function() | |
180 | char=script.Parent.Parent | |
181 | rightArmWeld=Instance.new("Weld") | |
182 | rightArmWeld.Parent=char.Torso | |
183 | rightArmWeld.Part0=char.Torso | |
184 | rightArmWeld.Part1=char["Right Arm"] | |
185 | rightArmWeld.Name="RightWeld" | |
186 | rightArmWeld.C0=CFrame.new(1.5,0.5,0) | |
187 | rightArmWeld.C1=CFrame.new(0,0.5,0) | |
188 | leftArmWeld=Instance.new("Weld") | |
189 | leftArmWeld.Parent=char.Torso | |
190 | leftArmWeld.Name="LeftWeld" | |
191 | leftArmWeld.Part0=char.Torso | |
192 | leftArmWeld.Part1=char["Left Arm"] | |
193 | leftArmWeld.C0=CFrame.new(-1.5,0.5,0) | |
194 | leftArmWeld.C1=CFrame.new(0,0.5,0) | |
195 | equip() | |
196 | debounce=false | |
197 | end) | |
198 | script.Parent.Unequipped:connect(function() | |
199 | char=nil | |
200 | rightArmWeld:Remove() | |
201 | leftArmWeld:Remove() | |
202 | rightArmWeld=nil | |
203 | leftArmWeld=nil | |
204 | end) | |
205 | end)) | |
206 | Part4.Name = "Flame" | |
207 | Part4.Parent = Tool0 | |
208 | Part4.BrickColor = BrickColor.new("Bright red") | |
209 | Part4.Transparency = 1 | |
210 | Part4.Size = Vector3.new(1.97999871, 0.640000284, 0.510000348) | |
211 | Part4.CFrame = CFrame.new(-3.19277, 0.801472008, -11.4081182, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
212 | Part4.Color = Color3.new(0.768628, 0.156863, 0.109804) | |
213 | Part4.Position = Vector3.new(-3.19277, 0.801472008, -11.4081182) | |
214 | Part4.Color = Color3.new(0.768628, 0.156863, 0.109804) | |
215 | SpecialMesh5.Parent = Part4 | |
216 | SpecialMesh5.MeshType = Enum.MeshType.Sphere | |
217 | for i,v in pairs(mas:GetChildren()) do | |
218 | v.Parent = game.Players.LocalPlayer.Backpack | |
219 | pcall(function() v:MakeJoints() end) | |
220 | end | |
221 | mas:Destroy() | |
222 | for i,v in pairs(cors) do | |
223 | spawn(function() | |
224 | pcall(v) | |
225 | end) | |
226 | end |