I am making a system where the script detects where two objects are and fires a laser from one to the other so to get the length of the laser I do some maths. However, when I enter the variable it does not count it as a vector3.
Code:
local laserpos = game.ServerStorage.MeatLoaf:Clone() laserpos.Parent = game.Workspace.Camera local tool = script.Parent local mouse = game.Players.LocalPlayer:GetMouse() local laser = game.ServerStorage.Laser:Clone() laser.Parent = game.Workspace.Camera mouse.TargetFilter = game.Workspace.Camera local clicked = false tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() clicked = true end) mouse.Button1Up:connect(function() clicked = false tool.Fire1.BrickColor=BrickColor.Black() game.Workspace.Camera.MeatLoaf.Position = game.Workspace.ss.Position game.Workspace.Camera.Laser.Position = game.Workspace.ss.Position end) end) while wait(0.05) do if clicked then local mouse = game.Players.LocalPlayer:GetMouse() tool.Fire1.BrickColor=BrickColor.Red() local LLX = ((tool.Fire1.Position.X-game.Workspace.Camera.MeatLoaf.Position.X)/2) + game.Workspace.Camera.MeatLoaf.Position.X local LLZ = ((tool.Fire1.Position.Z-game.Workspace.Camera.MeatLoaf.Position.Z)/2) + game.Workspace.Camera.MeatLoaf.Position.Z local LLY = ((tool.Fire1.Position.Y-game.Workspace.Camera.MeatLoaf.Position.Y)/2) + game.Workspace.Camera.MeatLoaf.Position.Y local LL = math.sqrt(LLX^2+LLZ^2+LLY^2) game.Workspace.Camera.Laser.Size=LL,0.5,0.5 game.Workspace.Camera.Laser.Position=((tool.Fire1.Position-game.Workspace.Camera.MeatLoaf.Position)/2) + game.Workspace.Camera.MeatLoaf.Position game.Workspace.Camera.MeatLoaf.Position=mouse.Hit.p wait(0.05) end end
error: Players.Player1.Backpack.Multi Tool.LocalScript:35: bad argument #3 to 'Size' (Vector3 expected, got number)
The Size
Property takes in Vector datatypes.
On Line 35 you provided a tuple.
Simply make it a vector using the Vector3.new function.
game.Workspace.Camera.Laser.Size = Vector3.new(LL,0.5,0.5);