[Post is Outdated]


which one

Make sure CanQuery is enabled on the walls.

1 Like

i joined group but cant edit the game yet

image
i probably dont have high enough rank to edit games

good now
image


everything seems to work although i didnt change anything except for adding debug part lol

image
it now detects if you hit accesorries
now let me make the debug part dynamic so you could see it

image

ok
https://gyazo.com/7abd029a1b9e7a8e5d916abce69008e8

local RunService = game:GetService('RunService')

local Camera = script.Parent
local Range = 20

local Part = Instance.new("Part")
Part.Size = Vector3.new(0.2, 0.2, Range)
Part.CFrame = CFrame.new(Camera.Position, Camera.CFrame.LookVector + Camera.Position) * CFrame.new(0, 0, -Range/2)
Part.Parent = workspace
Part.Anchored = true

local Filter = RaycastParams.new()
Filter.FilterType = Enum.RaycastFilterType.Exclude
Filter.FilterDescendantsInstances = {Camera, Part}

RunService.Stepped:Connect(function()
	local Raycast = game.Workspace:Raycast(Camera.Position, Camera.CFrame.LookVector * Range, Filter)
	
	Part.Size = Vector3.new(0.2, 0.2, Raycast and (Raycast.Position - Camera.Position).Magnitude or Range)
	Part.CFrame = CFrame.new(Camera.Position, Camera.CFrame.LookVector + Camera.Position) * CFrame.new(0, 0, -Part.Size.Z/2)
	
	
	if Raycast ~= nil then
		print(Raycast.Instance)
		local Model = Raycast.Instance:FindFirstAncestorWhichIsA("Model")
		if Model:FindFirstChildOfClass("Humanoid") then
			print('Detected!')
		end
	end
end)