You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I just want a laser going until it touches a part. -
What is the issue? Include screenshots / videos if possible!
It’s acting in a confusing way. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried switching places on stuff but it won’t work.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Start = script.Parent
local End = game.Workspace.End
local rayCastParams = RaycastParams.new()
local Origin = Start.Position
local Direction = Start.CFrame.LookVector * 20
local rayCastResult = workspace:Raycast(Origin, Direction)
if rayCastResult then
local Part = Instance.new("Part")
local EndPosition = rayCastResult.Instance.Position
local midPoint = Origin + EndPosition / 2
local Size = (EndPosition - Start.Position).Magnitude
Part.Parent = game.Workspace
Part.Anchored = true
Part.CFrame = CFrame.new(midPoint, Start.Position)
Part.Size = Vector3.new(1, 1, Size)
Part.Name = "Laser"
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.