Make sure CanQuery is enabled on the walls.
1 Like
i joined group but cant edit the game yet
i probably dont have high enough rank to edit games
good now
it now detects if you hit accesorries
now let me make the debug part dynamic so you could see it
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)