View difference between Paste ID: 0mPDBKcW and dRRGPW10
SHOW: | | - or go back to the newest paste.
1-
-- This script has been converted to FE by iPxter
1+
2
function sandbox(var,func)
3
	local env = getfenv(func)
4-
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
4+
5-
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
5+
6-
do
6+
7-
	print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
7+
8-
	script.Parent = Player.Character
8+
9
				return env[k]
10-
	--RemoteEvent for communicating
10+
11-
	local Event = Instance.new("RemoteEvent")
11+
12-
	Event.Name = "UserInput_Event"
12+
13
	setfenv(func,newenv)
14-
	--Fake event to make stuff like Mouse.KeyDown work
14+
15-
	local function fakeEvent()
15+
16-
		local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
16+
17-
		t.connect = t.Connect
17+
18-
		return t
18+
19
Part1 = Instance.new("Part")
20
SpecialMesh2 = Instance.new("SpecialMesh")
21-
	--Creating fake input objects with fake variables
21+
22-
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
22+
23-
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
23+
24-
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
24+
25-
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
25+
26-
	end}
26+
27-
	--Merged 2 functions into one by checking amount of arguments
27+
28-
	CAS.UnbindAction = CAS.BindAction
28+
29
ImageLabel11 = Instance.new("ImageLabel")
30-
	--This function will trigger the events that have been :Connect()'ed
30+
31-
	local function te(self,ev,...)
31+
32-
		local t = m[ev]
32+
33-
		if t and t._fakeEvent and t.Function then
33+
34-
			t.Function(...)
34+
35
Frame17 = Instance.new("Frame")
36
Frame18 = Instance.new("Frame")
37-
	m.TrigEvent = te
37+
38-
	UIS.TrigEvent = te
38+
39
BoolValue21 = Instance.new("BoolValue")
40-
	Event.OnServerEvent:Connect(function(plr,io)
40+
41-
	    if plr~=Player then return end
41+
42-
		if io.isMouse then
42+
43-
			m.Target = io.Target
43+
44-
			m.Hit = io.Hit
44+
45
Tool0.GripRight = Vector3.new(0.89442718, 0.44721359, 0)
46-
			local b = io.UserInputState == Enum.UserInputState.Begin
46+
47-
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
47+
48-
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
48+
49
Part1.Parent = Tool0
50-
			for _,t in pairs(CAS.Actions) do
50+
51-
				for _,k in pairs(t.Keys) do
51+
52-
					if k==io.KeyCode then
52+
53-
						t.Function(t.Name,io.UserInputState,io)
53+
54-
					end
54+
55
Part1.Position = Vector3.new(-9.45001221, 2, 3.62001061)
56
Part1.Color = Color3.new(1, 1, 0.8)
57-
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
57+
58-
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
58+
59-
	    end
59+
60
SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=72012935"
61-
	Event.Parent = NLS([==[
61+
62-
	local Player = game:GetService("Players").LocalPlayer
62+
63-
	local Event = script:WaitForChild("UserInput_Event")
63+
64
Sound3.Name = "Fire"
65-
	local UIS = game:GetService("UserInputService")
65+
66-
	local input = function(io,a)
66+
67-
		if a then return end
67+
68-
		--Since InputObject is a client-side instance, we create and pass table instead
68+
69-
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
69+
70
Sound4.SoundId = "rbxassetid://2761842"
71-
	UIS.InputBegan:Connect(input)
71+
72-
	UIS.InputEnded:Connect(input)
72+
73
IntValue5.Parent = Tool0
74-
	local mouse = Player:GetMouse()
74+
75-
	local h,t
75+
76-
	--Give the server mouse data 30 times every second, but only if the values changed
76+
77-
	--If player is not moving their mouse, client won't fire events
77+
78-
	while wait(1/30) do
78+
79-
		if h~=Mouse.Hit or t~=Mouse.Target then
79+
80-
			h,t=Mouse.Hit,Mouse.Target
80+
81-
			Event:FireServer({isMouse=true,Target=t,Hit=h})
81+
82
firerate=1.5
83-
	end]==],Player.Character)
83+
84-
	Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
84+
85
rate=1/30
86
spinuptime=0
87
barreloffset=Vector3.new(0,2.75,.375)
88
windvec=Vector3.new(2,-1,1).unit
89
firetime=0
90
maxammo=5
91
reloadtime = 5
92
ammo=maxammo
93
94
debris=game:GetService("Debris")
95
equipped=false
96
check=true
97
firing=false
98
reloading=false
99
100
function wait(TimeToWait)
101
	if TimeToWait ~= nil then
102
		local TotalTime = 0
103
		TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
104
		while TotalTime < TimeToWait do
105
			TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
106
		end
107
	else
108
		game:GetService("RunService").Heartbeat:wait()
109
	end
110
end
111
112
function waitfor(parent,name)
113
	while parent:FindFirstChild(name)==nil do
114
		wait()
115
	end
116
	return parent:FindFirstChild(name)
117
end
118
119
function checkintangible(hit)
120
	if hit and hit~=nil then
121
		if hit:IsDescendantOf(sp.Parent) or hit.Transparency>.8 or hit.Name=="Handle" or hit.Name=="Effect" or hit.Name=="Bullet" or hit.Name=="Laser" or string.lower(hit.Name)=="water" or hit.Name=="Rail" or hit.Name=="Arrow" then
122
			return true
123
		end
124
	end
125
	return false
126
end
127
128
function castray(startpos,vec,length,ignore,delayifhit)
129
	local hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),ignore)
130
	if hit~=nil then
131
		if checkintangible(hit) then
132
			if delayifhit then
133
				wait()
134
			end
135
			hit,endpos2=castray(endpos2+(vec*.01),vec,length-((startpos-endpos2).magnitude),ignore,delayifhit)
136
		end
137
	end
138
	return hit,endpos2
139
end
140
141
function wait(TimeToWait)
142
	if TimeToWait ~= nil then
143
		local TotalTime = 0
144
		TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
145
		while TotalTime < TimeToWait do
146
			TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
147
		end
148
	else
149
		game:GetService("RunService").Heartbeat:wait()
150
	end
151
end
152
153
function drawbeam(beamstart,beamend,clr,fadedelay)
154
	local dist=(beamstart-beamend).magnitude
155
	local laser=Instance.new("Part")
156
	laser.Name="Effect"
157
	laser.Anchored=true
158
	laser.CanCollide=false
159
	laser.Shape="Block"
160
	laser.formFactor="Custom"
161
	laser.Size=Vector3.new(.2,.2,.2)
162
	laser.Transparency=0
163
	laser.Material=Enum.Material.Plastic
164
	laser.Locked=true
165
	laser.TopSurface=0
166
	laser.BottomSurface=0
167
	laser.BrickColor=clr
168
	laser.CFrame=CFrame.new(beamend,beamstart)*CFrame.new(0,0,-dist/2)*CFrame.Angles(math.pi/2,0,0)
169
	local m=Instance.new("SpecialMesh")
170
	m.Scale=Vector3.new(1,dist*5,1)
171
	m.MeshType="Brick"
172
	m.Parent=laser
173
	debris:AddItem(laser,fadedelay*0.5)
174
	laser.Parent=game.Workspace
175
176
	--[[local frames=math.floor(fadedelay/rate)
177
	for frame=1,frames do
178
		wait(rate)
179
		local percent=frame/frames
180
		laser.CFrame=laser.CFrame+windvec*rate
181
		laser.Transparency=.5+(percent*.5)
182
	end]]
183
	wait(.5)
184
	laser:remove()
185
end
186
187
function fire()
188
	local hu=sp.Parent:FindFirstChild("Humanoid")
189
	local he=sp.Parent:FindFirstChild("Head")
190
	local t=sp.Parent:FindFirstChild("Torso")
191
	if hu and hu.Health>0 and t and he and themouse~=nil and equipped then
192
193
		anim2 = sp.Parent.Humanoid:LoadAnimation(sp.FireAni)
194
		if anim2 then anim2:Play() anim2:AdjustSpeed(1.75) end
195
		local startpos=he.Position
196
		local fakestartpos=(sp.Handle.CFrame*CFrame.new(barreloffset)).p
197
		local vec=(themouse.Hit.p-startpos).unit + (Vector3.new(math.random(-1000,1000),math.random(-1000,1000),math.random(-1000,1000)) / (1500*1500))
198
199
		local p=Instance.new("Part")
200
		p.Name="Effect"
201
		p.BrickColor=BrickColor.new("Black")
202
		p.CanCollide=false
203
		p.TopSurface="Smooth"
204
		p.BottomSurface="Smooth"
205
		p.formFactor="Custom"
206
		p.Size=Vector3.new(0,0,0)
207
		p.Transparency=1
208
		local m=Instance.new("SpecialMesh")
209
		m.Parent=p
210
211
		local hit,endpos=castray(startpos,vec,range,sp.Parent,false)
212
		local fakevec=(endpos-fakestartpos).unit
213
		if hit~=nil then
214
			local newcf=CFrame.new(endpos,endpos+fakevec)*CFrame.Angles(math.pi/2,0,0)*CFrame.new(0,0,0)
215
			p.CFrame=newcf
216
			local w=Instance.new("Weld")
217
			w.Part0=hit
218
			w.Part1=p
219
			w.C0=hit.CFrame:inverse()*newcf
220
			w.C1=newcf:inverse()*newcf
221
			w.Parent=p
222
223
			local c=Instance.new("ObjectValue")
224
			c.Name="creator"
225
			c.Value=owner
226
			c.Parent=p
227
			
228
			local Humanoid = hit.Parent:FindFirstChild("Humanoid")
229
			local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
230
			if Humanoid ~= nil then hit.Parent.Humanoid:TakeDamage(250)
231
			if Humanoid and Humanoid.Health <= 200 and hit.Name == "Head" and Player then sp["HeadshotPlayer"..math.random(1,2)]:Play() end
232
		else
233
			p.CFrame=CFrame.new(endpos,endpos+fakevec)
234
			p.Velocity=fakevec*power
235
			p.Parent=game.Workspace
236
		end
237
238
239
		debris:AddItem(p,1)
240
		p.Parent=game.Workspace
241
242
		delay(0,function()
243
			drawbeam(fakestartpos,endpos,BrickColor.new("Bright yellow"),.1)
244
		end)
245
246
		local sound=sp.Handle:FindFirstChild("Fire")
247
		if sound~=nil then
248
			--sound:Stop()
249
			sound:Play()
250
		end
251
252
		local shoulder=t:FindFirstChild("Right Shoulder")
253
		if shoulder~=nil then
254
			shoulder.CurrentAngle=(math.pi/2)+.1
255
			end
256
		end
257
	end
258
end
259
260
function onEquipped(mouse)
261
	equipped=true
262
	if mouse~=nil then
263
		anim = sp.Parent.Humanoid:LoadAnimation(sp.idle)
264
		if anim then anim:Play() end
265
		themouse=mouse
266
		mouse.Icon="http://www.roblox.com/asset/?id=2966012"
267
		mouse.Button1Down:connect(function()
268
			if sp.Enabled == false then return end
269
			sp.Enabled = false
270
			if ammo > 0 then
271
				ammo = ammo - 1
272
				fire()
273
			else
274
				Reload()
275
			end
276
			--mouse.Icon="http://www.roblox.com/asset/?id=2966012"
277
			Delay(firerate,function() if ammo == 0 then Reload() end sp.Enabled = true end)
278
		end)
279
		mouse.Button1Up:connect(function()
280
			--mouse.Icon="http://www.roblox.com/asset/?id=2966012"
281
		end)
282
		mouse.KeyDown:connect(function(Key)
283
			if string.lower(Key) == "r" then
284
				if ammo ~= maxammo and sp.Enabled == true then sp.Enabled = false Reload() sp.Enabled = true end
285
			elseif string.lower(Key) == "e" then
286
				if sp.AimDown.Value == false then
287
					Workspace.CurrentCamera.FieldOfView = 12.5
288
					local GUI = owner.PlayerGui:FindFirstChild("ZoomGui") or sp.ZoomGui:Clone()
289
					GUI.Parent = owner.PlayerGui
290
					owner.CameraMode = Enum.CameraMode.LockFirstPerson
291
					sp.AimDown.Value = true
292
					mouse.Icon="http://www.roblox.com/asset?id=187746799"
293
				else
294
					Workspace.CurrentCamera.FieldOfView = 70
295
					local GUI = owner.PlayerGui:FindFirstChild("ZoomGui")
296
					if GUI then GUI:Destroy() end
297
					owner.CameraMode = Enum.CameraMode.Classic
298
					sp.AimDown.Value = false
299
					mouse.Icon="http://www.roblox.com/asset/?id=2966012"
300
				end
301
			end
302
		end)
303
	end
304
end
305
306
function Reload()
307
	anim3 = sp.Parent.Humanoid:LoadAnimation(sp.Reload)
308
	if anim3 then anim3:Play() anim3:AdjustSpeed(2.5) end
309
	local sound=sp.Handle:FindFirstChild("Reload")
310
	if sound~=nil then
311
		sound:Play()
312
	end
313
	wait(reloadtime)
314
	ammo = maxammo
315
end
316
317
function onUnequipped()
318
	if anim then anim:Stop() end
319
	equipped=false
320
	themouse=nil
321
	if sp.AimDown.Value == true then
322
		Workspace.CurrentCamera.FieldOfView = 70
323
		local GUI = owner.PlayerGui:FindFirstChild("ZoomGui")
324
		if GUI then GUI:Destroy() end
325
		owner.CameraMode = Enum.CameraMode.Classic
326
		sp.AimDown.Value = false
327
	end
328
end
329
330
sp.Equipped:connect(onEquipped)
331
sp.Unequipped:connect(onUnequipped)
332
333
end))
334
Animation7.Name = "FireAni"
335
Animation7.Parent = Tool0
336
Animation7.AnimationId = "http://www.roblox.com/Asset?ID=94332152"
337
Animation8.Name = "Reload"
338
Animation8.Parent = Tool0
339
Animation8.AnimationId = "http://www.roblox.com/Asset?ID=94332664"
340
Animation9.Name = "idle"
341
Animation9.Parent = Tool0
342
Animation9.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
343
ScreenGui10.Name = "ZoomGui"
344
ScreenGui10.Parent = Tool0
345
ImageLabel11.Name = "Scope"
346
ImageLabel11.Parent = ScreenGui10
347
ImageLabel11.Transparency = 1
348
ImageLabel11.Size = UDim2.new(0, 750, 0, 750)
349
ImageLabel11.Position = UDim2.new(0.5, -375, 0.5, -390)
350
ImageLabel11.BackgroundColor3 = Color3.new(0, 0, 0)
351
ImageLabel11.BackgroundTransparency = 1
352
ImageLabel11.BorderColor3 = Color3.new(0, 0, 0)
353
ImageLabel11.Image = "http://www.roblox.com/asset/?id=72002022"
354
ImageLabel11.ImageColor3 = Color3.new(255, 255, 255)
355
Frame12.Parent = ImageLabel11
356
Frame12.Size = UDim2.new(0, 750, 0, 500)
357
Frame12.Position = UDim2.new(0, 0, 0, -450)
358
Frame12.BackgroundColor3 = Color3.new(0, 0, 0)
359
Frame12.BorderColor3 = Color3.new(0, 0, 0)
360
Frame13.Parent = ImageLabel11
361
Frame13.Size = UDim2.new(0, 750, 0, 500)
362
Frame13.Position = UDim2.new(0, 0, 1, -50)
363
Frame13.BackgroundColor3 = Color3.new(0, 0, 0)
364
Frame13.BorderColor3 = Color3.new(0, 0, 0)
365
Frame14.Parent = ImageLabel11
366
Frame14.Size = UDim2.new(0, 500, 1, 100)
367
Frame14.Position = UDim2.new(1, -50, 0, -50)
368
Frame14.BackgroundColor3 = Color3.new(0, 0, 0)
369
Frame14.BorderColor3 = Color3.new(0, 0, 0)
370
Frame15.Parent = ImageLabel11
371
Frame15.Size = UDim2.new(0, 500, 1, 100)
372
Frame15.Position = UDim2.new(0, -450, 0, -50)
373
Frame15.BackgroundColor3 = Color3.new(0, 0, 0)
374
Frame15.BorderColor3 = Color3.new(0, 0, 0)
375
Frame16.Name = "Crosshair"
376
Frame16.Parent = ScreenGui10
377
Frame16.Size = UDim2.new(1, 0, 0, 2)
378
Frame16.Position = UDim2.new(0, 0, 0.5, -16)
379
Frame16.BackgroundColor3 = Color3.new(0, 0, 0)
380
Frame16.BorderColor3 = Color3.new(0, 0, 0)
381
Frame16.BorderSizePixel = 0
382
Frame17.Name = "Crosshair"
383
Frame17.Parent = ScreenGui10
384
Frame17.Size = UDim2.new(0, 2, 1, 0)
385
Frame17.Position = UDim2.new(0.5, -1, 0, 0)
386
Frame17.BackgroundColor3 = Color3.new(0, 0, 0)
387
Frame17.BorderColor3 = Color3.new(0, 0, 0)
388
Frame17.BorderSizePixel = 0
389
Frame18.Name = "Crosshair"
390
Frame18.Parent = ScreenGui10
391
Frame18.Size = UDim2.new(0, 2, 0, 2)
392
Frame18.Position = UDim2.new(0.5, -1, 0.5, -16)
393
Frame18.BackgroundColor3 = Color3.new(1, 0, 0)
394
Frame18.BorderColor3 = Color3.new(0, 0, 0)
395
Frame18.BorderSizePixel = 0
396
Sound19.Name = "HeadshotPlayer1"
397
Sound19.Parent = Tool0
398
Sound19.SoundId = "rbxassetid://178070151"
399
Sound19.Volume = 1
400
Sound20.Name = "HeadshotPlayer2"
401
Sound20.Parent = Tool0
402
Sound20.SoundId = "rbxassetid://178072179"
403
Sound20.Volume = 1
404
BoolValue21.Name = "AimDown"
405
BoolValue21.Parent = Tool0
406
for i,v in pairs(mas:GetChildren()) do
407
	v.Parent = owner.Backpack
408
	pcall(function() v:MakeJoints() end)
409
end
410
mas:Destroy()
411
for i,v in pairs(cors) do
412
	spawn(function()
413
		pcall(v)
414
	end)
415
end