Hello,
im trying to make an iniesta’s skill from foootball called la croquetta,
or like i call it, double touch
this is skill is already on a popular football game called RESA
here a video
i tried to remake it,
it works but not everytime, like sometimes it works but the ball gets only the first touch (i mean when the ball goes in the right side) and not the second touch too (when the ball after going to right it should go forward), or theres sometimes where the ball doesnt even get the hit and it stays still without moving
here a video of my double touch problem
Here all i made
Script in serverscriptservice with the remote event
local RS = game:GetService("ReplicatedStorage")
local Event14 = RS:WaitForChild("React")
Event14.OnServerEvent:connect(function(player, ball, angle, power)
if ball.Name == "Ball" then
local React = Instance.new("BodyVelocity", ball)
React.Name = player.Name
React.Velocity = power
React.MaxForce = angle
React.Parent = ball
game.Debris:AddItem(React, 0.3)
end
end)
local script in the tool
local TM = require(script.Parent.Parent:WaitForChild("ToolManagment"))
Kick = false
Equipped = false
Tool = script.Parent
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
local cooldown = 1
local debounce = false
local anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.DoubleTouch)
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 ~= "y" then return end
if not debounce then
debounce = true
TM.SetUsing(true)
Kick = true
anim:Play()
wait(0.28)
Kick = false
TM.SetUsing(false)
wait(cooldown)
debounce = false
end
end)
Player.Character["Right Leg"].Touched:connect(function(hit)
if TM.check() == "L" then return end
if hit.Name ~= "Ball" then return end
if Kick == false then return end
local force = Player.Character["Right Leg"].CFrame.rightVector * -30
local angle = Vector3.new(40000,0,0)
Player.Character.Torso.RotVelocity = Vector3.new()
local SF = Instance.new("BodyVelocity")
SF.Parent = Player.Character["Torso"].Parent.HumanoidRootPart
SF.MaxForce = Vector3.new(math.huge,2500,math.huge)
SF.Velocity = Player.Character["Torso"].Parent.HumanoidRootPart.CFrame.rightVector * -35
game.Debris:AddItem(SF, 0.3)
Kick = false
TM.ApplyForce(hit, angle, force, "Right Leg")
wait(0.19)
local force2 = Player.Character["Right Leg"].CFrame.lookVector*30
local angle2 = Vector3.new(0,0, 30)
Kick = false
TM.Applyforce(hit, angle2, force2, "Right Leg")
end)
function ChangeOwner(ball)
game.ReplicatedStorage.ChangeOwner:FireServer(ball)
end
the module script inside starterpack with functions
local ToolManagement = {}
local player = game.Players.LocalPlayer
local Debris = game:GetService("Debris")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
local Torso = character:WaitForChild("Torso")
local Head = character:WaitForChild("Head")
local RA = character:WaitForChild("Right Arm")
local LA = character:WaitForChild("Left Arm")
local RL = character:WaitForChild("Right Leg")
local LL = character:WaitForChild("Left Leg")
local Using = false
local powerBar = player.PlayerGui.Start.PowerBar.PowerFrame
local windUp = false
local SF = "R"
Player = game.Players.LocalPlayer
local function LocalBodyVelocity(Ball, Angle, Power)
local Velocity = Instance.new("BodyVelocity", Ball)
Velocity.Name = player.Name
Velocity.Velocity = Power
Velocity.MaxForce = Angle
game.Debris:AddItem(Velocity, 0.3)
end
local function AnkleCheck()
local Chance = math.random(1, 2)
if Chance == 1 then
ToolManagement.Ankle()
else
return
end
end
function ToolManagement.check()
return SF
end
function ToolManagement.Set(F)
SF = F
end
function ToolManagement.ApplyForce(hit, angle, power, limb, ankle)
if hit.ReactDecline.Value == true and hit.Owner.Value ~= player and workspace.Configuration.FirstTouch.Value == true and ankle == true then
AnkleCheck()
return
end
if hit.ReactDecline.Value == true and hit.Owner.Value ~= player and workspace.Configuration.FirstTouch.Value == true then return end
hit.Sound:Play()
for i, v in pairs(hit:GetChildren()) do
if v:IsA("BodyVelocity") then
v:Remove ()
end
end
game.ReplicatedStorage.ChangeValue:FireServer(hit)
local React = Instance.new("BodyVelocity", hit)
React.Name = player.Name
React.Velocity = power
React.MaxForce = angle
game.Debris:AddItem(React, 0.3)
if hit.Owner.Value ~= player then
React:Remove()
if player.Ping.Value >= 300 then
game.ReplicatedStorage.ChangeOwner:FireServer(hit)
game.ReplicatedStorage.React:FireServer(hit, angle, power)
else
game.ReplicatedStorage.ChangeOwner:FireServer(hit)
LocalBodyVelocity(hit, angle, power)
end
end
end
function ToolManagement.SetUsing(b)
Using = b
end
function ToolManagement.GetUsing()
return Using
end
return ToolManagement
how can i make the ball do the 2 touches everytime? without make the ball stay still or only making it doing only one touch