#i need help with a push script
17 messages · Page 1 of 1 (latest)
script.Parent.Push.OnServerEvent:Connect(function(player, toPush)
if db then return end
db = true
task.delay(15, function() db = false end)
local playerRoot = player.Character:FindFirstChild("HumanoidRootPart")
local pushRoot = toPush:FindFirstChild("HumanoidRootPart")
if playerRoot and not playerRoot:FindFirstChild("PushF") and pushRoot and not pushRoot:FindFirstChild("PushF") then
if (playerRoot.Position - pushRoot.Position).Magnitude > 6 then return end
local pushF = Instance.new("BodyVelocity")
pushF.Name = "PushF"
pushF.MaxForce = Vector3.new(100000, 100000, 100000)
pushF.Velocity = (-pushRoot.CFrame.lookVector) * 50
pushF.Parent = pushRoot
wait(0.3)
pushF:Destroy()
end
end)```
local db = false
script.Parent.Push.OnServerEvent:Connect(function(player, toPush)
if db then return end
db = true
task.delay(15, function() db = false end)
local playerRoot = player.Character:FindFirstChild("HumanoidRootPart")
local pushRoot = toPush:FindFirstChild("HumanoidRootPart")
if playerRoot and not playerRoot:FindFirstChild("PushF") and pushRoot and not pushRoot:FindFirstChild("PushF") then
if (playerRoot.Position - pushRoot.Position).Magnitude > 6 then return end
local pushF = Instance.new("BodyVelocity")
pushF.Name = "PushF"
pushF.MaxForce = Vector3.new(100000, 100000, 100000)
pushF.Velocity = (playerRoot.CFrame.lookVector) * 50 --playerRoot instead of -PushRoot
pushF.Parent = pushRoot
wait(0.3)
pushF:Destroy()
end
end)
the whole script dosen't work anymore
Output
it dosen't appear in the output
nvm
ty
robbe i got another little problem
@tacit crater
...
the push script dosen't work again after the first push
you put in a delay of 15 Sekonds
that wasn't changeable?
you can change it, but then you can only punch every 15 sec