I have no idea about how that would work but
Is there a way where I can make the beam’s second attachment detect if something is in the way, for example a player, or a part? Literally anything? Because I want to make a realistic Moving Head System, just like in real life, the beams don’t go through walls, etc.
So… is there a way I can make the beams automatically adjust themselves down to where the part is, so not that the beams go through things, with a script?
Script demonstration would be appreciated.
Location of the beam:
I would suggest using
for i,v in pairs (game:GetService("Workspace").TaLights:GetChildren()) do
in the script, because I have multiple instances of these inside of the Folder.
You’d have to cast a ray in the direction of the beam and then move the attachment if an instance is found. A simple example of this would look something like such:
local part = -- Light here
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
rayParams.FilterDescendantsInstances = {part}
local attachmentToMove = -- attachment here
part:GetPropertyChangedSignal("CFrame"):Connect(function()
local ray = workspace:Raycast(part.Position, part.CFrame.LookVector * 50, rayParams)
if ray then
attachmentToMove.Position = ray.Position
end
end)