Hi all, got an issue with setting up I guess some like sword slam slash thing?
As seen from the gif, as the player moves around - even whilst I’m pressing the X, it’ll grab a CFrame from earlier on the movement rather than the actual position the player is facing when X is pressed.
The code for it is below:
return function(player, LookVector, PlayerCFrame)
wait(0.1)
local character = player.Character
local function RunAnimation(Animation, aspect)
local CurrentAnimaton = character.Humanoid:LoadAnimation(Animation)
if aspect == "Play" then
CurrentAnimaton:Play()
elseif aspect == "Stop" then
local AnimationTracks = character.Humanoid:GetPlayingAnimationTracks()
for i, track in pairs (AnimationTracks) do
if track.Name == CurrentAnimaton.Name then
track:Stop()
end
end
elseif aspect == "IsPlaying" then
if CurrentAnimaton:IsPlaying() == true then
return true
else
return false
end
end
end
RunAnimation(game.ReplicatedStorage.CCG.Animations:FindFirstChild("Yukimura"):FindFirstChild("YukimuraAttack1"), "Play")
wait(0.2)
local slamEffect = game.Workspace.Effect_Skill1:Clone()
slamEffect.Parent = game.Workspace
slamEffect.Position = character.HumanoidRootPart.Position + (character.HumanoidRootPart.CFrame.LookVector * 5)
slamEffect.CFrame = character.HumanoidRootPart.CFrame
local counter = 0
while counter ~= 40 do
--slamEffect.CFrame = slamEffect.CFrame + slamEffect.CFrame.LookVector * 3
slamEffect.Size = slamEffect.Size - Vector3.new(0,0.5,0)
slamEffect.Size = slamEffect.Size + Vector3.new(0,0,0.5)
slamEffect.Transparency += 0.05
counter += 1
wait()
end
slamEffect:Destroy()
end
I have tried parsing through the lookvector and cframe from the localscript and it has the same issue. I have also attempted running the animation via the player localscript then activating the event whilst parsing through the information but again to no avail.