local UserInputService = game:GetService("UserInputService")
local AttackVFX = game.Workspace.ATTACKVFX
local function attackfunction()
UserInputService.InputBegan:Connect(function(input, gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.F then
print("Testing")
AttackVFX.CFrame = CFrame.new(game.Players.LocalPlayer.Character.RightHand.Position)
wait(0.5)
local instance = AttackVFX
local Information = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.In)
game:GetService("TweenService"):Create(AttackVFX,Information,{CFrame = instance.CFrame + (instance.CFrame.LookVector * 5)}):Play()
end
end)
end
attackfunction()
How do I make the AttackVFX move forward where the player is facing? Right now it just moves in a set direction
This is because you’re placing the AttackVFX to the arm’s position without any orientation, then making the AttackVFX move forward in the direction it’s pointing in, which is always the same direction because it’s not using the arm’s rotation.
The other option, if for some reason that was intentional, is to use the arm’s direction in the tween:
However, the arm might have moved in that 0.5sec. If you do this, you should put the CFrame of the arm in a variable before the `wait(0.5) and use that to get the LookVector.