Hello,
i am trying to make something like this
so far for the movement i used tweenservice but it makes me bugging
here the script, basically i made it that when the right leg touches the ball it will make the movement
Kick = false
Equipped = false
Tool = script.Parent
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
local tweenservice = game:GetService("TweenService")
local TweenInfoo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local playersHumanoidRootPart = game.Workspace:WaitForChild(Player.Name).HumanoidRootPart
local tween = tweenservice:Create(playersHumanoidRootPart, TweenInfoo, {Position = playersHumanoidRootPart.Position + playersHumanoidRootPart.CFrame.rightVector * 10})
local anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Elastico)
script.Parent.Equipped:connect(function(m)
Equipped = true
end)
script.Parent.Unequipped:connect(function(m)
Equipped = false
end)
Mouse.KeyDown:connect(function(key)
if Equipped == false then return end
if TM.GetUsing() then return end
if key ~= "f" then return end
TM.SetUsing(true)
Kick = true
anim:Play()
wait(0.28)
TM.ResetWelds()
Kick = false
TM.SetUsing(false)
end)
Player.Character["Right Leg"].Touched:connect(function(hit)
if TM.check() == "L" then return end
if hit.Name ~= "TPS" then return end
if Kick == false then return end
local force = ((Player.Character["Torso"].CFrame * CFrame.fromEulerAnglesXYZ(0,-1,0)).lookVector * 10) + (Player.Character["Torso"].CFrame.upVector * 3.5)
local angle = Vector3.new(math.huge, math.huge, math.huge)
playersHumanoidRootPart.Anchored = true
tween:Play()
tween.Completed:Wait()
playersHumanoidRootPart.Anchored = false
Kick = false
TM.ApplyForce(hit, angle, force, "Right Leg")
end)
function ChangeOwner(ball)
game.ReplicatedStorage.ChangeOwner:FireServer(ball)
end
can u help me solve the bug? or do you know how to make a movement like that?