Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i use lookvector to point my players head?

Lets say i was making a gun.

( i am )

And i want to make im down sights.

Well, i can do this by using the players mouse.hit and aiming by this following line

weld1.C1 = CFrame.new(Player.Character.Head.CFrame.p,oldMouseHit):toObjectSpace(Player.Character.Torso.CFrame)

which is used in my mouse following head script

the gun parts are welded to the players head and the players head aimed to mouse.hit

but when i use these sequence of code

			Bullet = Instance.new("Part")
			Bullet.FormFactor = "Custom"
			Bullet.Name = "GunBullet"
			Bullet.Size = Vector3.new(.2,.2,.2)
			Bullet.CanCollide = false
			Bullet.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
			Bullet.BrickColor = BrickColor.new("Really Black")
			Bullet.Velocity = game.Players.LocalPlayer.Character.Head.CFrame.lookVector * 500
			Bullet.Parent = game.Workspace

the head of the player wants to look at this part that is spawned in when the gun is shot and it causes some glitchy aiming

so i was wondering if there was any other way to do aim the players head to there mouse without making it glitch out

i also tried using mouse.origin

but i could not use that right

thanks for anyone who will help :D

1 comment

0

You could use the targetfilter property of Mouse to keep the mouse from "interacting" with the Bullet. http://wiki.roblox.com/index.php?title=API:Class/Mouse/TargetFilter

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.