hi, i made a script that will be the barge, like in soccer.
so i want that when i touch the player, it gets knockback backwards.
here is a video on how it is
here the script
local debris = game:service("Debris")
bin = script.Parent
Go = script.Parent.Parent.Kick
Go1 = script.Parent.Parent.BKick
Go.Value = 0
Go1.Value = 0
local deb = false
Kick = false
function onKeyDown(key)
if Go.Value == 1 then return end
if Go1.Value == 1 then return end
if key ~= nil then
key = key:lower()
if key == "e" then
Go.Value = 1
Go1.Value = 1
if script.Parent.Parent.Parent.Character == nil then return end
if script.Parent.Parent.Parent.Character:findFirstChild("Right Arm") == nil then return end
local character = script.Parent.Parent.Parent.Character
RA = script.Parent.Parent.Parent.Character["Right Arm"]
local hum = script.Parent.Parent.Parent.Character:WaitForChild('Humanoid')
local anim = Instance.new("Animation")
anim.AnimationId = 'rbxassetid://9402175353'
hum:LoadAnimation(anim):Play()
Kick = true
RA.Touched:connect(function(hit)
if Kick == false then return end
if hit.Locked == true or hit.Anchored == true then return end
Kick = false
deb = true
if Go.Value == 1 then
if deb == true then
if hit.Parent:WaitForChild("Humanoid") == nil then return end
local lhum = hit.Parent:WaitForChild('Humanoid')
local anima = Instance.new("Animation")
anima.AnimationId = 'rbxassetid://9402179653'
lhum:LoadAnimation(anima):Play()
deb = false
end
end
end)
wait(0.2)
Kick = false
wait(2.5)
Go.Value = 0
Go1.Value = 0
end
end
end
bin.Deselected:connect(function()
end)
function onSelected(mouse)
mouse.KeyDown:connect(onKeyDown)
end
bin.Selected:connect(onSelected)
can you help me?