So I'm just trying to add bullet tracers for my gun, but when I tell the script to go to the mouse hit position, it gives me an error. Here's the script:

script.Parent.OnServerEvent:Connect(function(mouse,hit) --//The mouse and the mouse hit
	--//Bullet Tracer Creation
	local Tracer = Instance.new("Part",workspace)
	Tracer.CanCollide = false
	Tracer.Shape = "Block"
	Tracer.Size = Vector3.new(0.2,0.2,0.2)
	Tracer.Material = "Neon"
	Tracer.Name = "BulletTracer"
	Tracer.BrickColor = BrickColor.new("Neon orange")
	--//Bullet Tracer Creation End
	
	--//Bullet Tracer Positioning
	Tracer.CFrame = CFrame.new(script.Parent.Parent.Handle.Position, hit.Position) --//Part that gives me an error.
	--//Bullet Tracer Body Velocity
	local Velocity = Instance.new("BodyVelocity", Tracer)
	Velocity.Velocity = Tracer.CFrame.LookVector*700
end)

The tracer appears, but it doesn't work smoothly, due to that error. (This is through a server script)

4 comments

0

could you provide the error

0

Position is not a valid member of Vector3

0

try removing ".Position" from "hit.Position" at line 13

0

I did that. Same thing happens.