the title explains it self, im making a top down rpg game, just like guest quest, i need help with something tho.
thats my code for now, its a local script inside of starter character scripts:
local rayDirection = Vector3.new(0,1,0) local char = game.Players.LocalPlayer.Character local RAY_LENGTH = 30 function findAllPartsOnRay(ray) local targets = {} repeat local target = game.Workspace:FindPartOnRayWithIgnoreList(ray, targets) if target then table.insert(targets, target) end until not target return targets end game:GetService("RunService").Heartbeat:Connect(function() local ray = Ray.new(char.Head.Position,rayDirection * RAY_LENGTH) local parts = findAllPartsOnRay(ray) if parts then for index, value in ipairs(parts) do value.Transparency = 0.7 wait() value.Transparency = 0 end end end)
i mean it works but it keeps blinking, so i want to make that the part becomes visible only when the ray its not hitting it