local pos = mouse.Hit.p
local s = (pos-tool.SmokePart.Position).Magnitude
local laser = Instance.new("Part")
laser.Name = "Ray"
laser.Transparency = .75
laser.CanCollide = false
laser.FormFactor = "Custom"
laser.Anchored = true
laser.BrickColor = BrickColor.new("Really black")
laser.Size = Vector3.new(.2,.2, s)
laser.CFrame = CFrame.new(pos, tool.SmokePart.Position)*CFrame.new(0,0,-s/2)
game.Workspace:FindPartOnRayWithIgnoreList(laser, {game.Workspace})
laser.Parent = workspace
game.Debris:AddItem(laser, .75)
The third to last line is the only error printing out "Unable to cast value to Object" can you guys help me and explain to me why this doesnt work, I have multiple versions of the second to last line but I need some help, Thank You!

2 comments
Your issue is actually line 12. First off, you aren't storing that in anything and second off, I don't think you can put workspace as an ignorable object.
You can put anything that is under "game" the list ignores all descendants of the objects in the table, putting "Workspace" in the table just makes the Ray Casting function useless!