How do I make a projectile face the same way as the player?
So far i made it so that you can attack with a button1down function but I cant make it so the projectile that is spawned faces the same way as the player without changing the orientation.
01 | player = game.Players.LocalPlayer |
02 | repeat wait() until player.Character ~ = nil |
03 | local hum = player.Character.HumanoidRootPart |
04 | local mouse = player:GetMouse() |
05 | local tweenservice = game:GetService( "TweenService" ) |
07 | local function attack() |
08 | local direction = hum.CFrame.lookVector * 60 |
09 | local part = game.ReplicatedStorage.Water:Clone() |
10 | part.Parent = workspace |
11 | part.CanCollide = false |
12 | part.Velocity = direction |
13 | part.CFrame = CFrame.new( 0 , 0 , 0 ) |
14 | part.Orientation = Vector 3. new(- 90 , 0 , 0 ) |
15 | part.Position = hum.Position + Vector 3. new( 0 ,-. 5 , 0 ) |
16 | local bf = Instance.new( "BodyForce" ) |
17 | bf.Force = Vector 3. new( 0 , workspace.Gravity * part:GetMass() * 1 , 0 ) |
22 | mouse.Button 1 Down:Connect(attack) |
I did manage to change the orientation but when I do that the projectile doesn't shoot from the player. Any suggestions?