hello im currently trying to detect when one part hits another, yet the .touched event isnt working as shown in the video
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local Camera = workspace.CurrentCamera
local Viewport = script.Parent.Viewport
local World = Viewport.World
local Pivot = World.Pivot
local Hit = World.Hit
local Visual = Pivot.Visual
local ForceDirectionXIncremint = 0.01
local function UpdateRotation()
local PartPosition = Pivot.Position
local ScreenPosition = Camera:WorldToScreenPoint(PartPosition)
local Direction = Vector2.new(Mouse.X, Mouse.Y) - Vector2.new(ScreenPosition.X, ScreenPosition.Y)
local Angle = math.atan2(Direction.Y, Direction.X)
local Degrees = math.deg(Angle) + -90
Pivot.CFrame = CFrame.new(Pivot.Position) * CFrame.Angles(0, 0, math.rad(-Degrees))
Hit.Position += Vector3.new(ForceDirectionXIncremint, 0, 0)
end
RunService.RenderStepped:Connect(UpdateRotation)
Visual.Touched:Connect(function(OtherPart)
print(OtherPart)
end)