mouse.KeyDown:connect(function(key)
if key == "e" and Kick == true then
local RL = script.Parent:FindFirstChildOfClass("RightFoot")
RL.Touched:connect(function(hit)
if Kick == false then return end
if hit.Name == "Ball" then
Kick = false
local F = Instance.new("BodyVelocity")
F.Parent = hit
F.velocity = RL.CFrame.lookVector * 20
F.maxForce = (script.Parent.Parent.Angle.Value)
local playAnim2 = humanoid:LoadAnimation(anim2)
Kick = false
playAnim2:Play()
Kick = false
humanoid.WalkSpeed = 0
wait(1)
humanoid.WalkSpeed = 25
Kick = true
end
end)
end
end)
I dont think it got the RightFoot.
anyway, Thanks for reading!
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and Kick == true then
local RL = script.Parent:FindFirstChildOfClass("RightFoot")
RL.Touched:connect(function(hit)
if Kick == false then return end
if hit.Name == "Ball" then
Kick = false
local F = Instance.new("BodyVelocity")
F.Parent = hit
F.velocity = RL.CFrame.lookVector * 20
F.maxForce = (script.Parent.Parent.Angle.Value)
local playAnim2 = humanoid:LoadAnimation(anim2)
Kick = false
playAnim2:Play()
Kick = false
humanoid.WalkSpeed = 0
wait(1)
humanoid.WalkSpeed = 25
Kick = true
end
end)
end
end)
Alright? is the script inside the player character? if yes, can you try doing this?
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and Kick == true then
local RL = script.Parent:WaitForChild("RightFoot")
RL.Touched:connect(function(hit)
if Kick == false then return end
if hit.Name == "Ball" then
Kick = false
local F = Instance.new("BodyVelocity")
F.Parent = hit
F.velocity = RL.CFrame.lookVector * 20
F.maxForce = (script.Parent.Parent.Angle.Value)
local playAnim2 = humanoid:LoadAnimation(anim2)
Kick = false
playAnim2:Play()
Kick = false
humanoid.WalkSpeed = 0
wait(1)
humanoid.WalkSpeed = 25
Kick = true
end
end)
end
end)
mouse.KeyDown:connect(function(key)
if key == "e" and Kick then
local RL = script.Parent.RightFoot
RL.Touched:connect(function(hit)
if not Kick then
return
end
if hit.Name == "Ball" then
Kick = false
local F = Instance.new("BodyVelocity")
F.Velocity = RL.CFrame.LookVector * 20
F.MaxForce = (script.Parent.Parent.Angle.Value)
F.Parent = hit
humanoid.WalkSpeed = 0
local playAnim2 = humanoid:LoadAnimation(anim2)
playAnim2:Play()
task.wait(1)
humanoid.WalkSpeed = 25
Kick = true
end
end)
end
end)
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and Kick == true then
local RL = script.Parent:WaitForChild("RightFoot")
RL.Touched:connect(function(hit)
print("touched")
if Kick == false then return end
if hit.Name == "Ball" then
Kick = false
local F = Instance.new("BodyVelocity")
F.Parent = hit
F.velocity = RL.CFrame.lookVector * 20
F.maxForce = (script.Parent.Parent.Angle.Value)
local playAnim2 = humanoid:LoadAnimation(anim2)
Kick = false
playAnim2:Play()
Kick = false
humanoid.WalkSpeed = 0
wait(1)
humanoid.WalkSpeed = 25
Kick = true
end
end)
end
end)
Can you test this and tell me if it prints “touched”?
I think you’re talking about kick animation. Try use :GetTouchingParts on the right foot. This will return a table of the parts that touched the right foot. check is there’s a part in it then play the animation.