Hello developers, I would like to know what is causing my raycast to break.
I’ve tried to replace the old raycast with a custom one but for whatever reason it just stays where it started initially upon joining.
local userInputService = game:GetService("UserInputService") local player = game.Players.LocalPlayer local mouse = player:GetMouse() local runService = game:GetService("RunService") local mousePos = userInputService:GetMouseLocation() local mouseRay = workspace.CurrentCamera:ViewportPointToRay(mousePos.X, mousePos.Y) mouseRay = workspace:Raycast(mouseRay.Origin, mouseRay.Direction * 1000) runService.RenderStepped:Connect(function() if mouseRay then print("Object/terrain hit:", mouseRay.Instance:GetFullName()) print("Hit position:", mouseRay.Position) print("Surface normal at the point of intersection:", mouseRay.Normal) print("Material hit:", mouseRay.Material.Name) else print("Nothing was hit!") end end)
Any help with this is appreciated,