View difference between Paste ID: cMr6EvcM and 8gk0tGgX
SHOW: | | - or go back to the newest paste.
1
-- Game Link: https://www.roblox.com/games/863266079/Apocalypse-Rising-2-Alpha
2
3
loadstring(game:HttpGetAsync('https://pastebin.com/raw/yFD4crSn'))() 
4
local target
5
6
local camera		= workspace.CurrentCamera
7
local plr			= game.Players.LocalPlayer
8
9
local input		 	= game:GetService("UserInputService")
10
11
local on			= false
12
13
local hum           = plr.Character.HumanoidRootPart
14
15
local findNear = function()
16
	local near, cur = 0, nil
17
	for _,v in pairs(game.Players:GetPlayers()) do
18
		if v.Character then
19
            if v.Name ~= plr.Name and (v.Character.Head.Position-plr.Character.Head.Position).magnitude < near or near == 0 and v.Name ~= plr.Name then
20
                near = (v.Character.Head.Position-plr.Character.Head.Position).magnitude
21
                cur = v.Character.Head
22
            end
23
        end
24
	end
25
	return cur
26
end
27
28
input.InputBegan:connect(function(input, func)
29
	if not func then
30
		if input.UserInputType == Enum.UserInputType.MouseButton2 then
31
			target = findNear()
32
		elseif input.KeyCode == Enum.KeyCode.X then
33
			on = not on
34
		end
35
	end
36
end)
37
38
input.InputEnded:connect(function(input, func)
39
	if not func then
40
		if input.UserInputType == Enum.UserInputType.MouseButton2 then
41
			target = nil
42
		end
43
	end
44
end)
45
46
game["Run Service"].RenderStepped:connect(function()
47
	if target and on then
48
		print('found')
49
		camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
50
        hum.CFrame = CFrame.new(hum.Position, Vector3.new(target.Position.X,hum.Position.Y,target.Position.Z))
51
	end
52
end)
53
54
print('ran!')