In this script a part will follow the mouse, I just want to know how you would use a Union from the lighting instead of a part, thanks.
01 | tool = script.Parent |
02 |
03 | function onButton 1 Down(mouse) |
04 | local target = mouse.Target |
05 | local q = Instance.new( "Part" , Workspace) |
06 | q.Size = Vector 3. new( 3 , 3 , 3 ) |
07 | q.Anchored = true |
08 | q.CanCollide = False |
09 | while true do |
10 | wait() |
11 | q.CFrame = CFrame.new(Vector 3. new(tool.Parent.Humanoid.TargetPoint.X, 0 ,tool.Parent.Humanoid.TargetPoint.Z)) |
12 | end |
13 | end |
14 | function onEquipped(mouse) |
15 | mouse.Button 1 Down:connect( function () onButton 1 Down(mouse) end ) |
16 | end |
17 |
18 | tool.Equipped:connect(onEquipped) |
(Apologies if I have tagged wrong/incorrectly)
Try the following
01 | local tool = script.Parent |
02 | local spawned = false |
03 |
04 | function onButton 1 Down(mouse) |
05 | if spawned then return end |
06 | local target = mouse.Target |
07 | local q = game.Lighting.Union:Clone() |
08 | q.Parent = Workspace |
09 | q.Size = Vector 3. new( 3 , 3 , 3 ) |
10 | q.Anchored = true |
11 | q.CanCollide = False |
12 | spawned = true |
13 | while spawned do |
14 | wait() |
15 | q.CFrame = CFrame.new(Vector 3. new(tool.Parent.Humanoid.TargetPoint.X, 0 ,tool.Parent.Humanoid.TargetPoint.Z)) |