Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My laser starts buzzing (turning on and off) when it points in certain directions how fix ?

Asked by
ym5a 52
2 years ago
local RunService = game:GetService("RunService")
laser = Instance.new("Part")
while true do
    RunService.Heartbeat:Wait() 
    local res = workspace:Raycast(script.Parent.Position,script.Parent.CFrame.LookVector*100)
    if res then
        laser.Material = Enum.Material.Neon
        laser.BrickColor = BrickColor.Red()
        laser.CanCollide = false
        laser.Anchored  = true
        laser.Parent = workspace
        laser.CFrame = CFrame.new((script.Parent.Position+res.Position)/2,res.Position)
        laser.Size = Vector3.new(.1,.1,(script.Parent.Position-res.Position).Magnitude)
    end
end

The script ^ What happens: https://gyazo.com/d6d13f11fbedab88073126b988913e9f

0
I think that it's seeing the laser part when you try to raycast, try to add the laser part to the blacklist the8bitdude11 358 — 2y
0
Yeah id di that it works ym5a 52 — 2y

Answer this question