I have a localscript that allows to send rays when I put a command in the chat. The problem is that with Streaming enabled it won’t work. I know I have to add “RequestStreamAroundAsync()” at the problem location, but I don’t know how to do it.
Code:
local function createLighting(part, tool, f)
local point1 = tool.Handle.CFrame:toWorldSpace(CFrame.new(-1.5, 0, 0))
local point2
local core, outer
local connection = runs.RenderStepped:Connect(function()
point2 = part.CFrame:toWorldSpace(CFrame.new(math.random() * 1 - 0.5, math.random() * 1 - 0.5, 0))
core = line(point1, point2, part, 0.2, 0, BrickColor.new("Institutional white"))
outer = line(point1, point2, part, 0.6, 0.75, part.BrickColor)
point1 = point2
if f then
f(outer)
end
end)
part.Changed:Connect(function(property)
if property == "Parent" then
wait(0.1)
connection:Disconnect()
end
end)
end
The problem is in “point2 = part.CFrame:toWorldSpace(CFrame.new(math.random() * 1 - 0.5, math.random() * 1 - 0.5, 0))”