View difference between Paste ID: kZqCqfd0 and 37qvrpq1
SHOW: | | - or go back to the newest paste.
1-
--[[
1+
Character = game.Players.LocalPlayer.Character
2-
	Made by Kiriot22
2+
Player = owner
3-
	lel
3+
char = Character
4-
--]]
4+
hum = Character.Humanoid
5-
local plr = owner
5+
Torso = Character.Torso
6-
local char = plr.Character
6+
Head = Character.Head
7
-- This script has been converted to FE by iPxter
8
9
10
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
11
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
12
do
13
	print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
14
	script.Parent = Player.Character
15
16
	--RemoteEvent for communicating
17
	local Event = Instance.new("RemoteEvent")
18
	Event.Name = "UserInput_Event"
19
20
	--Fake event to make stuff like Mouse.KeyDown work
21
	local function fakeEvent()
22
		local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
23
		t.connect = t.Connect
24
		return t
25
	end
26
27
	--Creating fake input objects with fake variables
28
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
29
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
30
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
31
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
32
	end}
33
	--Merged 2 functions into one by checking amount of arguments
34
	CAS.UnbindAction = CAS.BindAction
35
36
	--This function will trigger the events that have been :Connect()'ed
37
	local function te(self,ev,...)
38
		local t = m[ev]
39
		if t and t._fakeEvent and t.Function then
40
			t.Function(...)
41
		end
42
	end
43
	m.TrigEvent = te
44
	UIS.TrigEvent = te
45
46
	Event.OnServerEvent:Connect(function(plr,io)
47
	    if plr~=Player then return end
48
		if io.isMouse then
49
			m.Target = io.Target
50
			m.Hit = io.Hit
51
		else
52
			local b = io.UserInputState == Enum.UserInputState.Begin
53
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
54
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
55
			end
56
			for _,t in pairs(CAS.Actions) do
57
				for _,k in pairs(t.Keys) do
58
					if k==io.KeyCode then
59
						t.Function(t.Name,io.UserInputState,io)
60
					end
61
				end
62
			end
63
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
64
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
65
	    end
66
	end)
67
	Event.Parent = NLS([==[
68
	local Player = game:GetService("Players").LocalPlayer
69
	local Event = script:WaitForChild("UserInput_Event")
70
71
	local UIS = game:GetService("UserInputService")
72
	local input = function(io,a)
73
		if a then return end
74
		--Since InputObject is a client-side instance, we create and pass table instead
75
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
76
	end
77
	UIS.InputBegan:Connect(input)
78
	UIS.InputEnded:Connect(input)
79
80
	local Mouse = Player:GetMouse()
81
	local h,t
82
	--Give the server mouse data 30 times every second, but only if the values changed
83
	--If player is not moving their mouse, client won't fire events
84
	while wait(1/30) do
85
		if h~=Mouse.Hit or t~=Mouse.Target then
86
			h,t=Mouse.Hit,Mouse.Target
87
			Event:FireServer({isMouse=true,Target=t,Hit=h})
88
		end
89
	end]==],Player.Character)
90
	Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
91
end
92
93-
function FindInTable(t, n)
93+
	char.Shirt.ShirtTemplate = "rbxassetid://994469018"
94-
	for i,v in pairs(t) do
94+
	char.Pants.PantsTemplate = "rbxassetid://977437883"
95-
		if v == n then
95+
96
97
	local BC = char["Body Colors"]
98
	BC.HeadColor = BrickColor.new("Really black")
99
	BC.LeftArmColor = BrickColor.new("Really black")
100
	BC.LeftLegColor = BrickColor.new("Really black")
101-
--Transformaaaaation--
101+
	BC.RightArmColor = BrickColor.new("Really black")
102-
char["Left Arm"].BrickColor = BrickColor.new("Medium stone")
102+
	BC.RightLegColor = BrickColor.new("Really black")
103-
char["Right Arm"].BrickColor = BrickColor.new("Medium stone")
103+
	BC.TorsoColor = BrickColor.new("Really black")
104-
char.Head.BrickColor = BrickColor.new("Medium stone")
104+
105-
char["Left Leg"].BrickColor = BrickColor.new("Medium stone")
105+
	char.Head.face.Texture = "rbxassetid://701379058"
106-
char["Right Leg"].BrickColor = BrickColor.new("Medium stone")
106+
107
hum.MaxHealth = math.huge
108-
for i,v in pairs(char:children'') do
108+
109-
	local toremove = {"CharacterMesh", "Shirt", "Pants", "ShirtGraphic", "Accessory"}
109+
110-
	if FindInTable(toremove, v.ClassName) then v:Destroy() end
110+
111-
	if v.ClassName == "BodyColors" then
111+
112-
		v.HeadColor = BrickColor.new("Medium stone")
112+
for i,v in pairs(char:children()) do
113-
		v.LeftArmColor = BrickColor.new("Medium stone")
113+
    if v:IsA("Hat") then
114-
		v.LeftLegColor = BrickColor.new("Medium stone")
114+
        v:Destroy()
115-
		v.RightArmColor = BrickColor.new("Medium stone")
115+
    end
116-
		v.RightLegColor = BrickColor.new("Medium stone")
116+
117-
		v.TorsoColor = BrickColor.new("Medium stone")
117+
for i,v in pairs(char:children()) do
118
    if v:IsA("Accessory") then
119
        v:Destroy()
120
    end
121-
local face = char.Head:FindFirstChild'face' if face then face.Texture = "http://www.roblox.com/asset/?id=13038247" end
121+
122-
Instance.new("Shirt", char).ShirtTemplate = "http://www.roblox.com/asset/?id=120599107"
122+
for i,v in pairs(char:children()) do
123-
Instance.new("Pants", char).PantsTemplate = "http://www.roblox.com/asset/?id=281982286"
123+
    if v:IsA("Hair") then
124-
local function CreateHat(name, meshid, textureid)
124+
        v:Destroy()
125-
	local h = Instance.new("Accessory")
125+
    end
126-
	h.Name = name
126+
127-
	local han = Instance.new("Part", h)
127+
--141378828
128-
	han.Name = "Handle"
128+
Reaper = Instance.new("Model")
129-
	local mesh = Instance.new("SpecialMesh", han)
129+
Reaper.Parent = Player.Character
130-
	mesh.Name = "Mesh"
130+
Reaper.Name = "Reaper"
131-
	mesh.MeshId = meshid
131+
rh = Instance.new("Part")
132-
	mesh.TextureId = textureid
132+
rh.Parent = Reaper
133-
	return h,han,mesh
133+
rh.BrickColor = BrickColor.new("Really red")
134
rh.Locked = true
135-
hum = char:FindFirstChildOfClass'Humanoid'
135+
rh.CanCollide = false
136-
local h,han,mesh = CreateHat("2LEGITOwl", "http://www.roblox.com/asset/?id=329798434", "http://www.roblox.com/asset/?id=329790966")
136+
mesh = Instance.new("SpecialMesh")
137-
han.Size = Vector3.new(1, 1, 1)
137+
rh.formFactor =  "Symmetric"
138-
mesh.Scale = Vector3.new(0.3, 0.3, 0.3)
138+
mesh.MeshType = "FileMesh"
139-
h.AttachmentPos = Vector3.new(1.1, 0.38, 0)
139+
mesh.MeshId = "http://www.roblox.com/asset/?id=112643970"
140-
hum:AddAccessory(h)
140+
mesh.TextureId = "http://www.roblox.com/asset/?id=1018233493"
141-
h,han,mesh = CreateHat("RobloxScarf", "http://www.roblox.com/asset/?id=138054351", "http://www.roblox.com/asset/?id=138052904")
141+
mesh.Parent = rh
142-
mesh.Scale = Vector3.new(3, 3, 3)
142+
mesh.Scale = Vector3.new(1.1,1.1,1.1)
143-
han.Size = Vector3.new(1.9, 2, 2)
143+
local weld = Instance.new("Weld")
144-
h.AttachmentPos = Vector3.new(0, 1.54, 0.1)
144+
weld.Parent = rh
145-
hum:AddAccessory(h)
145+
rh.Transparency = 0
146-
h,han,mesh = CreateHat("Ultra-Fabulous Hair", "http://www.roblox.com/asset/?id=16627529", "http://www.roblox.com/asset/?id=16627494")
146+
weld.Part0 = rh
147-
mesh.Scale = Vector3.new(1.05, 1.05, 1.05)
147+
weld.Part1 = Player.Character.Head
148-
han.Size = Vector3.new(2, 2, 2)
148+
weld.C0 = CFrame.new(-0, -0.05, -0)*CFrame.Angles(0, 0, 0)
149-
hum:AddAccessory(h)
149+
150-
--a function--
150+
local s = Instance.new("Sound",char)
151-
function Say(text)
151+
s.SoundId = "http://www.roblox.com/asset/?id=565420180"
152-
	local head = char.Head
152+
s.Pitch = 1
153-
	local fh = head:Clone()
153+
s.Volume = 2
154-
	fh:ClearAllChildren()
154+
s.Looped = true
155-
	fh.Transparency = 1
155+
wait(1)
156-
	local bg = Instance.new("BillboardGui", fh)
156+
s:play()
157-
	bg.Size = UDim2.new(6, 0, 6, 0)
157+
local txtfag = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head)
158-
	bg.StudsOffset = Vector3.new(0, 3, 0)
158+
txtfag.Adornee = suckadick
159-
	local f = Instance.new("Frame", bg)
159+
txtfag.Name = "kys nigga"
160-
	f.Size = UDim2.new(1, 0, 1, 0)
160+
txtfag.Size = UDim2.new(2, 0, 1.2, 0)
161-
	f.BackgroundTransparency = 1
161+
txtfag.StudsOffset = Vector3.new(-5, 3, 0)
162-
	local tl = Instance.new("TextLabel", f)
162+
local textfag = Instance.new("TextLabel", txtfag)
163-
	tl.BackgroundTransparency = 1
163+
textfag.Size = UDim2.new(6, 0, 1, 0)
164-
	tl.Size = UDim2.new(5, 0, 1, 0)
164+
textfag.FontSize = "Size8"
165-
	tl.Position = UDim2.new(-2, 0, 0)
165+
textfag.TextScaled = true
166-
	tl.TextColor3 = Color3.new(1, 1, 1)
166+
textfag.TextTransparency = 0
167-
	tl.TextScaled = true
167+
textfag.BackgroundTransparency = 1
168-
	tl.Text = ""
168+
textfag.TextTransparency = 0
169-
	tl.TextColor3 = BrickColor.new("Really black").Color	
169+
textfag.TextStrokeTransparency = 0
170-
	tl.Font = Enum.Font.Fantasy
170+
textfag.Font = "Cartoon"
171-
	tl.TextSize = 120
171+
textfag.TextStrokeColor3 = Color3.new(0, 0, 0)
172-
	fh.Parent = Instance.new("Model", plr.Character)
172+
textfag.Text = game.Players.LocalPlayer.Character.Name.." the Anti-Skid "
173-
	local Joint = Instance.new("Weld", game.JointsService)
173+
174-
	Joint.Part0 = head
174+
175-
	Joint.Part1 = fh
175+
local runDummyScript = function(f,scri)
176
local oldenv = getfenv(f)
177-
	local letters = {}
177+
local newenv = setmetatable({}, {
178-
	text:gsub(".",function(c) table.insert(letters,c) end)
178+
__index = function(_, k)
179-
	for i,v in pairs(letters) do
179+
if k:lower() == 'script' then
180-
		tl.Text = tl.Text .. tostring(v)
180+
return scri
181-
		wait(1/20)
181+
else
182
return oldenv[k]
183-
	wait(1)
183+
184-
	fh.Parent:Destroy()
184+
185
})
186
setfenv(f, newenv)
187-
function ReloadChat() --hax
187+
ypcall(function() f() end)
188-
	local chat = plr:FindFirstChildOfClass'PlayerGui':FindFirstChild'SB_Chat'
188+
189-
	if chat then
189+
cors = {}
190-
		chat:Destroy()
190+
mas = Instance.new("Model",game:GetService("Lighting")) 
191
mas.Name = "CompiledModel"
192-
	plr.PlayerScripts.ChatScript:Destroy()
192+
o1 = Instance.new("Tool")
193-
	game:GetService("Chat").ChatScript:Clone().Parent = plr.PlayerScripts
193+
o2 = Instance.new("Part")
194-
	plr:FindFirstChildOfClass'PlayerGui':WaitForChild'Chat'.Name = "SB_Chat"
194+
o3 = Instance.new("SpecialMesh")
195
o4 = Instance.new("Sound")
196
o5 = Instance.new("Sound")
197-
function RunFromUrl(url)
197+
o6 = Instance.new("Sound")
198-
	require(game:GetService'Players'.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("ChatScript"):WaitForChild("ChatMain")).MessagePosted:fire("hl/" .. url)
198+
o7 = Instance.new("PointLight")
199
o8 = Instance.new("Sound")
200
o10 = Instance.new("LocalScript")
201-
ReloadChat()
201+
o11 = Instance.new("Animation")
202
o12 = Instance.new("ScreenGui")
203-
local ScriptsNames = {
203+
o13 = Instance.new("Frame")
204-
	{
204+
o14 = Instance.new("TextLabel")
205-
		Name = "Bloxwatch hacker",
205+
o15 = Instance.new("TextLabel")
206-
		Url = "https://pastebin.com/raw/BTLbGeEg"
206+
o16 = Instance.new("TextLabel")
207-
	},
207+
o17 = Instance.new("Frame")
208-
	{
208+
o18 = Instance.new("Frame")
209-
		Name = "Hover Bike",
209+
o19 = Instance.new("Frame")
210-
		Url = "http://pastebin.com/raw/EBaLUy81"
210+
o20 = Instance.new("Frame")
211-
	},
211+
o21 = Instance.new("ImageLabel")
212-
	{
212+
o22 = Instance.new("TextLabel")
213-
		Name = "Gold Radio",
213+
o23 = Instance.new("Frame")
214-
		Url = "https://pastebin.com/raw/SJcQD3zX"
214+
o24 = Instance.new("Frame")
215-
	},
215+
o25 = Instance.new("TextLabel")
216-
	{
216+
o26 = Instance.new("LocalScript")
217-
		Name = "Gomu Powers",
217+
o1.Name = "AUG"
218-
		Url = "https://pastebin.com/raw/dp4BrV03"
218+
o1.Parent = game.Players.LocalPlayer.Backpack
219-
	},
219+
o1.TextureId = "http://www.roblox.com/asset/?id=122079912"
220-
	{
220+
o1.GripForward = Vector3.new(-0.242535636, -0, -0.970142484)
221-
		Name = "Flying plane",
221+
o1.GripPos = Vector3.new(0.200000003, -0.400000006, 0.200000003)
222-
		Url = "https://pastebin.com/raw/9pKtz6sK"
222+
o1.GripRight = Vector3.new(0.970142484, 0, -0.242535636)
223-
	},
223+
o1.ToolTip = "Steyr AUG"
224-
	{
224+
o1.CanBeDropped = false
225-
		Name = "Lenny",
225+
o2.Name = "Handle"
226-
		Url = "https://paste.ee/r/ddsm4"
226+
o2.Parent = o1
227-
	},
227+
o2.BrickColor = BrickColor.new("Black")
228-
	{
228+
o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005)
229-
		Name = "Angel wings",
229+
o2.FormFactor = Enum.FormFactor.Custom
230-
		Url = "https://pastebin.com/raw/2NPdCp7d"
230+
o2.Size = Vector3.new(0.200000003, 1, 3.5999999)
231-
	},
231+
o2.CFrame = CFrame.new(15.9000006, -8.5, 3.20000005, 1, 0, 0, 0, 1, 0, 0, 0, 1)
232-
	{
232+
o2.BottomSurface = Enum.SurfaceType.Smooth
233-
		Name = "Hackerman",
233+
o2.TopSurface = Enum.SurfaceType.Smooth
234-
		Url = "https://pastebin.com/raw/FWbG0NwV"
234+
o2.Color = Color3.new(0.105882, 0.164706, 0.207843)
235-
	}
235+
o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005)
236-
}
236+
o3.Parent = o2
237-
local Fat = {"op", "dank", "cool", "fun"}
237+
o3.MeshId = "http://www.roblox.com/asset/?id=3824738"
238
o3.Scale = Vector3.new(1.33000004, 1.33000004, 1.33000004)
239-
local rnd = math.random(1, #ScriptsNames)
239+
o3.TextureId = "http://www.roblox.com/asset?ID=3824735 "
240
o3.MeshType = Enum.MeshType.FileMesh
241-
local randomscript = ScriptsNames[rnd]
241+
o4.Name = "FireSound"
242
o4.Parent = o2
243-
Say("Hello youtube")
243+
o4.Pitch = 1.3999999761581
244-
Say("And today I'm showcasing " .. randomscript.Name .. " script")
244+
o4.SoundId = "http://www.roblox.com/asset/?id=10209859 "
245-
Say("It is a very " .. Fat[math.random(1, #Fat)] .. " script")
245+
o4.Volume = 1
246-
Say("Let me show you what it does")
246+
o5.Name = "Reload"
247-
RunFromUrl(randomscript.Url)
247+
o5.Parent = o2
248-
Say("Remember to leave a like and subscribe")
248+
o5.SoundId = "http://www.roblox.com/asset/?id=2691591"
249
o5.Volume = 1
250
o6.Name = "EquipSound"
251
o6.Parent = o2
252
o6.SoundId = "http://www.roblox.com/asset/?id=10209881"
253
o6.Volume = 1
254
o7.Name = "Flash"
255
o7.Parent = o2
256
o7.Color = Color3.new(1, 1, 0)
257
o7.Enabled = false
258
o7.Brightness = 1.5
259
o8.Name = "Tick"
260
o8.Parent = o2
261
o8.SoundId = "rbxasset://sounds//clickfast.wav"
262
o8.Volume = 1
263
o10.Name = "AUG"
264
o10.Parent = o1
265
print("Giving "..game.Players.LocalPlayer.Name.. " an " ..o1.Name.. " Don't leak this. If you do i will fucking shoot you till your dead ;\ ")
266
table.insert(cors,coroutine.create(function()
267
wait()
268
runDummyScript(function()
269
--------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
270
-- Waits for the child of the specified parent
271
local function WaitForChild(parent, childName)
272
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
273
	return parent[childName]
274
end
275
276
----- MAGIC NUMBERS ABOUT THE TOOL -----
277
-- How much damage a bullet does
278
local Damage = 65
279
-- How many times per second the gun can fire
280
local FireRate = 1 / 15
281
-- The maximum distance the can can shoot, this value should never go above 1000
282
local Range = 700
283
-- In radians the minimum accuracy penalty
284
local MinSpread = 0.01
285
-- In radian the maximum accuracy penalty
286
local MaxSpread = 0.06
287
-- Number of bullets in a clip
288
local ClipSize = 30
289
-- DefaultValue for spare ammo
290
local SpareAmmo = math.huge
291
-- The amount the aim will increase or decrease by
292
-- decreases this number reduces the speed that recoil takes effect
293
local AimInaccuracyStepAmount = 0.01
294
-- Time it takes to reload weapon
295
local ReloadTime = 2.3
296
----------------------------------------
297
298
-- Colors
299
local FriendlyReticleColor = Color3.new(0, 1, 0)
300
local EnemyReticleColor	= Color3.new(1, 0, 0)
301
local NeutralReticleColor	= Color3.new(1, 1, 1)
302
303
local Spread = MinSpread
304
local AmmoInClip = ClipSize
305
306
local Tool = o1
307
local Handle = WaitForChild(Tool, 'Handle')
308
local WeaponGui = nil
309
310
local LeftButtonDown
311
local Reloading = false
312
local IsShooting = false
313
314
-- Player specific convenience variables
315
local MyPlayer = nil
316
local MyCharacter = nil
317
local MyHumanoid = nil
318
local MyTorso = nil
319
local MyMouse = nil
320
321
local RecoilAnim
322
local RecoilTrack = nil
323
324
local IconURL = Tool.TextureId  -- URL to the weapon icon asset
325
326
local DebrisService = game:GetService('Debris')
327
local PlayersService = game:GetService('Players')
328
329
330
local FireSound
331
332
local OnFireConnection = nil
333
local OnReloadConnection = nil
334
335
local DecreasedAimLastShot = false
336
local LastSpreadUpdate = time()
337
338
-- this is a dummy object that holds the flash made when the gun is fired
339
local FlashHolder = nil
340
341
342
local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
343
local GetCellFunction = Workspace.Terrain.GetCell
344
345
function RayIgnoreCheck(hit, pos)
346
	if hit then
347
		if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
348
				hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
349
				hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
350
			return true
351
		elseif hit:IsA('Terrain') and pos then
352
			local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
353
			if cellPos then
354
				local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
355
				if cellMat and cellMat == Enum.CellMaterial.Water then
356
					return true
357
				end
358
			end
359
		end
360
	end
361
	return false
362
end
363
364
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
365
function RayCast(startPos, vec, rayLength)
366
	local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
367
	if hitObject and hitPos then
368
		local distance = rayLength - (hitPos - startPos).magnitude
369
		if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
370
			-- there is a chance here for potential infinite recursion
371
			return RayCast(hitPos, vec, distance)
372
		end
373
	end
374
	return hitObject, hitPos
375
end
376
377
378
379
function TagHumanoid(humanoid, player)
380
	-- Add more tags here to customize what tags are available.
381
	while humanoid:FindFirstChild('creator') do
382
		humanoid:FindFirstChild('creator'):Destroy()
383
	end 
384
	local creatorTag = Instance.new("ObjectValue")
385
	creatorTag.Value = player
386
	creatorTag.Name = "creator"
387
	creatorTag.Parent = humanoid
388
	DebrisService:AddItem(creatorTag, 1.5)
389
390
	local weaponIconTag = Instance.new("StringValue")
391
	weaponIconTag.Value = IconURL
392
	weaponIconTag.Name = "icon"
393
	weaponIconTag.Parent = creatorTag
394
end
395
396
397
local function CreateBullet(bulletPos)
398
	local bullet = Instance.new('Part', Workspace)
399
	bullet.FormFactor = Enum.FormFactor.Custom
400
	bullet.Size = Vector3.new(0.1, 0.1, 0.1)
401
	bullet.BrickColor = BrickColor.new("Black")
402
	bullet.Shape = Enum.PartType.Block
403
	bullet.CanCollide = false
404
	bullet.CFrame = CFrame.new(bulletPos)
405
	bullet.Anchored = true
406
	bullet.TopSurface = Enum.SurfaceType.Smooth
407
	bullet.BottomSurface = Enum.SurfaceType.Smooth
408
	bullet.Name = 'Bullet'
409
	DebrisService:AddItem(bullet, 2.5)
410
	return bullet
411
end
412
413
local function Reload()
414
	if not Reloading then
415
		Reloading = true
416
		-- Don't reload if you are already full or have no extra ammo
417
		if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
418
			if RecoilTrack then
419
				RecoilTrack:Stop()
420
			end
421
			if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
422
				if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
423
					WeaponGui.Crosshair.ReloadingLabel.Visible = true
424
				end
425
			end
426
			script.Parent.Handle.Reload:Play()
427
			wait(ReloadTime)
428
			-- Only use as much ammo as you have
429
			local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
430
			AmmoInClip = AmmoInClip + ammoToUse
431
			SpareAmmo = SpareAmmo - ammoToUse
432
			UpdateAmmo(AmmoInClip)
433
			WeaponGui.Reload.Visible = false
434
		end
435
		Reloading = false
436
	end
437
end
438
439
function OnFire()
440
	if IsShooting then return end
441
	if MyHumanoid and MyHumanoid.Health > 0 then
442
		if RecoilTrack and AmmoInClip > 0 then
443
			RecoilTrack:Play()
444
		end
445
		IsShooting = true
446
		while LeftButtonDown and AmmoInClip > 0 and not Reloading do
447
			if Spread and not DecreasedAimLastShot then
448
				Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
449
				UpdateCrosshair(Spread)
450
			end
451
			DecreasedAimLastShot = not DecreasedAimLastShot
452
			if Handle:FindFirstChild('FireSound') then
453
				Handle.FireSound:Play()
454
				Handle.Flash.Enabled = true
455
			end
456
			if MyMouse then
457
				local targetPoint = MyMouse.Hit.p
458
				local shootDirection = (targetPoint - Handle.Position).unit
459
				-- Adjust the shoot direction randomly off by a little bit to account for recoil
460
				shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
461
																(0.5 - math.random()) * 2 * Spread,
462
																(0.5 - math.random()) * 2 * Spread) * shootDirection
463
				local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
464
				local bullet
465
				-- Create a bullet here
466
				if hitObject then
467
					bullet = CreateBullet(bulletPos)
468
				end
469
				if hitObject and hitObject.Parent then
470
					local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
471
					if hitHumanoid then
472
						local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
473
						if MyPlayer.Neutral or hitPlayer then
474
							TagHumanoid(hitHumanoid, MyPlayer)
475
							hitHumanoid:TakeDamage(Damage)
476
							if bullet then
477
								bullet:Destroy()
478
								bullet = nil
479
								--bullet.Transparency = 1
480
							end
481
							Spawn(UpdateTargetHit)
482
						end
483
					end
484
				end
485
	
486
				AmmoInClip = AmmoInClip - 1
487
				UpdateAmmo(AmmoInClip)
488
			end
489
			wait(FireRate)
490
		end
491
		Handle.Flash.Enabled = false
492
		IsShooting = false
493
		if AmmoInClip == 0 then
494
			Handle.Tick:Play()
495
			WeaponGui.Reload.Visible = true
496
		end
497
		if RecoilTrack then
498
			RecoilTrack:Stop()
499
		end
500
	end
501
end
502
503
local TargetHits = 0
504
function UpdateTargetHit()
505
	TargetHits = TargetHits + 1
506
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
507
		WeaponGui.Crosshair.TargetHitImage.Visible = true
508
	end
509
	wait(0.5)
510
	TargetHits = TargetHits - 1
511
	if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
512
		WeaponGui.Crosshair.TargetHitImage.Visible = false
513
	end
514
end
515
516
function UpdateCrosshair(value, mouse)
517
	if WeaponGui then
518
		local absoluteY = 650
519
		WeaponGui.Crosshair:TweenSize(
520
			UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
521
			Enum.EasingDirection.Out,
522
			Enum.EasingStyle.Linear,
523
			0.33)
524
	end
525
end
526
527
function UpdateAmmo(value)
528
	if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
529
		WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
530
		if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
531
			WeaponGui.Crosshair.ReloadingLabel.Visible = false
532
		end
533
	end
534
	if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
535
		WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
536
	end
537
end
538
539
540
function OnMouseDown()
541
	LeftButtonDown = true
542
	OnFire()
543
end
544
545
function OnMouseUp()
546
	LeftButtonDown = false
547
end
548
549
function OnKeyDown(key)
550
	if string.lower(key) == 'r' then
551
		Reload()
552
	end
553
end
554
555
556
function OnEquipped(mouse)
557
	Handle.EquipSound:Play()
558
	RecoilAnim = WaitForChild(Tool, 'Recoil')
559
	FireSound  = WaitForChild(Handle, 'FireSound')
560
561
	MyCharacter = Tool.Parent
562
	MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
563
	MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
564
	MyTorso = MyCharacter:FindFirstChild('Torso')
565
	MyMouse = mouse
566
	WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
567
	if WeaponGui and MyPlayer then
568
		WeaponGui.Parent = MyPlayer.PlayerGui
569
		UpdateAmmo(AmmoInClip)
570
	end
571
	if RecoilAnim then
572
		RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
573
	end
574
575
	if MyMouse then
576
		-- Disable mouse icon
577
		MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
578
		MyMouse.Button1Down:connect(OnMouseDown)
579
		MyMouse.Button1Up:connect(OnMouseUp)
580
		MyMouse.KeyDown:connect(OnKeyDown)
581
	end
582
end
583
584
585
-- Unequip logic here
586
function OnUnequipped()
587
	LeftButtonDown = false
588
	Reloading = false
589
	MyCharacter = nil
590
	MyHumanoid = nil
591
	MyTorso = nil
592
	MyPlayer = nil
593
	MyMouse = nil
594
	if OnFireConnection then
595
		OnFireConnection:disconnect()
596
	end
597
	if OnReloadConnection then
598
		OnReloadConnection:disconnect()
599
	end
600
	if FlashHolder then
601
		FlashHolder = nil
602
	end
603
	if WeaponGui then
604
		WeaponGui.Parent = nil
605
		WeaponGui = nil
606
	end
607
	if RecoilTrack then
608
		RecoilTrack:Stop()
609
	end
610
end
611
612
local function SetReticleColor(color)
613
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
614
		for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
615
			if line:IsA('Frame') then
616
				line.BorderColor3 = color
617
			end
618
		end
619
	end
620
end
621
622
623
Tool.Equipped:connect(OnEquipped)
624
Tool.Unequipped:connect(OnUnequipped)
625
626
while true do
627
	wait(0.033)
628
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
629
		WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
630
		SetReticleColor(NeutralReticleColor)
631
632
		local target = MyMouse.Target
633
		if target and target.Parent then
634
			local player = PlayersService:GetPlayerFromCharacter(target.Parent)
635
			if player then
636
				if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
637
					SetReticleColor(EnemyReticleColor)
638
				else
639
					SetReticleColor(FriendlyReticleColor)
640
				end
641
			end
642
		end
643
	end
644
	if Spread and not IsShooting then
645
		local currTime = time()
646
		if currTime - LastSpreadUpdate > FireRate * 2 then
647
			LastSpreadUpdate = currTime
648
			Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
649
			UpdateCrosshair(Spread, MyMouse)
650
		end
651
	end
652
end
653
654
end,o10)
655
end))
656
o11.Name = "Recoil"
657
o11.Parent = o1
658
o11.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
659
o12.Name = "WeaponHud"
660
o12.Parent = o1
661
o13.Name = "AmmoHud"
662
o13.Parent = o12
663
o13.Position = UDim2.new(1,-265,1,-60)
664
o13.Size = UDim2.new(0,200,0,50)
665
o13.Style = Enum.FrameStyle.RobloxSquare
666
o13.Position = UDim2.new(1,-265,1,-60)
667
o13.BackgroundTransparency = 1
668
o13.BorderSizePixel = 0
669
o14.Name = "ForwardSlash"
670
o14.Parent = o13
671
o14.Position = UDim2.new(0.5,0,0.5,0)
672
o14.Text = "/"
673
o14.Position = UDim2.new(0.5,0,0.5,0)
674
o14.BackgroundTransparency = 1
675
o14.BorderSizePixel = 0
676
o14.FontSize = Enum.FontSize.Size24
677
o14.TextColor3 = Color3.new(1, 1, 1)
678
o14.TextStrokeTransparency = 0
679
o15.Name = "ClipAmmo"
680
o15.Parent = o13
681
o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
682
o15.Text = "54"
683
o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
684
o15.BackgroundTransparency = 1
685
o15.BorderSizePixel = 0
686
o15.FontSize = Enum.FontSize.Size24
687
o15.TextColor3 = Color3.new(1, 1, 1)
688
o15.TextStrokeTransparency = 0
689
o15.TextXAlignment = Enum.TextXAlignment.Right
690
o16.Name = "TotalAmmo"
691
o16.Parent = o13
692
o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
693
o16.Text = "180"
694
o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
695
o16.BackgroundTransparency = 1
696
o16.BorderSizePixel = 0
697
o16.FontSize = Enum.FontSize.Size24
698
o16.TextColor3 = Color3.new(1, 1, 1)
699
o16.TextStrokeTransparency = 0
700
o16.TextXAlignment = Enum.TextXAlignment.Left
701
o17.Name = "Crosshair"
702
o17.Parent = o12
703
o17.Position = UDim2.new(0,500,0,500)
704
o17.Size = UDim2.new(0,150,0,150)
705
o17.Position = UDim2.new(0,500,0,500)
706
o17.BackgroundColor3 = Color3.new(0, 1, 0)
707
o17.BackgroundTransparency = 1
708
o17.BorderSizePixel = 0
709
o18.Name = "TopFrame"
710
o18.Parent = o17
711
o18.Position = UDim2.new(0,-1,-0.5,-7)
712
o18.Size = UDim2.new(0,2,0,14)
713
o18.Position = UDim2.new(0,-1,-0.5,-7)
714
o18.BackgroundColor3 = Color3.new(1, 1, 1)
715
o18.BorderColor3 = Color3.new(0, 0, 0)
716
o19.Name = "RightFrame"
717
o19.Parent = o17
718
o19.Position = UDim2.new(0.5,-7,0,-1)
719
o19.Size = UDim2.new(0,14,0,2)
720
o19.Position = UDim2.new(0.5,-7,0,-1)
721
o19.BackgroundColor3 = Color3.new(1, 1, 1)
722
o19.BorderColor3 = Color3.new(0, 0, 0)
723
o20.Name = "LeftFrame"
724
o20.Parent = o17
725
o20.Position = UDim2.new(-0.5,-7,0,-1)
726
o20.Size = UDim2.new(0,14,0,2)
727
o20.Position = UDim2.new(-0.5,-7,0,-1)
728
o20.BackgroundColor3 = Color3.new(1, 1, 1)
729
o20.BorderColor3 = Color3.new(0, 0, 0)
730
o21.Name = "TargetHitImage"
731
o21.Parent = o17
732
o21.Position = UDim2.new(0,-25,0,-25)
733
o21.Size = UDim2.new(0,50,0,50)
734
o21.Position = UDim2.new(0,-25,0,-25)
735
o21.Visible = false
736
o21.BackgroundTransparency = 1
737
o21.BorderSizePixel = 0
738
o21.Image = "http://www.roblox.com/asset/?id=115400215"
739
o22.Name = "ReloadingLabel"
740
o22.Parent = o17
741
o22.Position = UDim2.new(0,20,0,-20)
742
o22.Text = "Reloading"
743
o22.Position = UDim2.new(0,20,0,-20)
744
o22.Visible = false
745
o22.BackgroundTransparency = 1
746
o22.BorderSizePixel = 0
747
o22.Font = Enum.Font.ArialBold
748
o22.FontSize = Enum.FontSize.Size18
749
o22.TextColor3 = Color3.new(1, 1, 1)
750
o22.TextStrokeTransparency = 0
751
o22.TextXAlignment = Enum.TextXAlignment.Left
752
o22.TextYAlignment = Enum.TextYAlignment.Bottom
753
o23.Name = "BottomFrame"
754
o23.Parent = o17
755
o23.Position = UDim2.new(0,-1,0.5,-7)
756
o23.Size = UDim2.new(0,2,0,14)
757
o23.Position = UDim2.new(0,-1,0.5,-7)
758
o23.BackgroundColor3 = Color3.new(1, 1, 1)
759
o23.BorderColor3 = Color3.new(0, 0, 0)
760
o24.Name = "Reload"
761
o24.Parent = o12
762
o24.Position = UDim2.new(1,-265,1,-120)
763
o24.Size = UDim2.new(0,200,0,50)
764
o24.Position = UDim2.new(1,-265,1,-120)
765
o24.Visible = false
766
o24.BackgroundTransparency = 1
767
o24.BorderSizePixel = 0
768
o25.Name = "Reload"
769
o25.Parent = o24
770
o25.Position = UDim2.new(0.5,0,0.5,0)
771
o25.Text = "Press R to Reload"
772
o25.Position = UDim2.new(0.5,0,0.5,0)
773
o25.BackgroundTransparency = 1
774
o25.BorderSizePixel = 0
775
o25.Font = Enum.Font.ArialBold
776
o25.FontSize = Enum.FontSize.Size24
777
o25.TextColor3 = Color3.new(1, 0, 0)
778
o25.TextStrokeTransparency = 0
779
o26.Name = "ArmWeld [Rifle]"
780
o26.Parent = o1
781
table.insert(cors,coroutine.create(function()
782
wait()
783
runDummyScript(function()
784
Tool = script.Parent;
785
786
local arms = nil
787
local torso = nil
788
local welds = {}
789
790
function Equip(mouse)
791
wait(0.01)
792
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
793
torso = Tool.Parent:FindFirstChild("Torso")
794
if arms ~= nil and torso ~= nil then
795
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
796
if sh ~= nil then
797
local yes = true
798
if yes then
799
yes = false
800
sh[1].Part1 = nil
801
sh[2].Part1 = nil
802
local weld1 = Instance.new("Weld")
803
weld1.Part0 = torso
804
weld1.Parent = torso
805
weld1.Part1 = arms[1]
806
weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90)) ---The first set of numbers changes where the arms move to the second set changes their angles
807
welds[1] = weld1
808
weld1.Name = "weld1"
809
local weld2 = Instance.new("Weld")
810
weld2.Part0 = torso
811
weld2.Parent = torso
812
weld2.Part1 = arms[2]
813
weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
814
welds[2] = weld2
815
weld2.Name = "weld2"
816
end
817
else
818
print("sh")
819
end
820
else
821
print("arms")
822
end
823
end
824
825
function Unequip(mouse)
826
if arms ~= nil and torso ~= nil then
827
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
828
if sh ~= nil then
829
local yes = true
830
if yes then
831
yes = false
832
sh[1].Part1 = arms[1]
833
sh[2].Part1 = arms[2]
834
welds[1].Parent = nil
835
welds[2].Parent = nil
836
end
837
else
838
print("sh")
839
end
840
else
841
print("arms")
842
end
843
end
844
Tool.Equipped:connect(Equip)
845
Tool.Unequipped:connect(Unequip)
846
847
end,o26)
848
end))
849
mas.Parent = workspace
850
mas:MakeJoints()
851
local mas1 = mas:GetChildren()
852
for i=1,#mas1 do
853
	mas1[i].Parent = workspace 
854
	ypcall(function() mas1[i]:MakeJoints() end)
855
end
856
mas:Destroy()
857
for i=1,#cors do
858
coroutine.resume(cors[i])
859
end