Script only works once

Hello. I have a working script:

local AttackVFX = game.Workspace.ATTACKVFX


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)

so the script works, but in the section where the direction it moves is where the player is facing, it works like that once, but is always stuck moving in that rotation / location, it doesn’t update if the character begins looking at a different subject

2 Likes

Is it still possible to get help with this error?

Move the wait(0.5) up. You’re using the CFrame of it 0.5s ago, of course it won’t be up to date.

2 Likes