local tool = script.Parent.Parent
local range = script.Parent.Parent.Range
local connectorpart1 = script.Parent.Parent.TrailPoint1
local beam = connectorpart1.Beam
tool.Activated:Connect(function()
local orb = script.Parent.Parent.Range.Orb
if orb.Value ~= nil then
beam.Attachment1 = orb.Value
elseif orb.Value == nil then
beam.Attachment1 = nil
end
end)
tool.Deactivated:Connect(function()
local orb = script.Parent.Parent.Range.Orb
if orb.Value ~= nil or orb.Value == nil then
beam.Attachment1 = nil
end
end)
this is a normal script inside a tool's handle.
when activated, the tool checks the object value to see if its value exists, then changes the beams attachment1 to the objectvalue's value. when deactivated it sets the attachment1 to nil.
the script throws an error stating: bad cast

2 comments
is the property "value" of range a number or an object?
range is an object. it contains the objectvalue.