Hello, I’m trying to make a battlegrounds game out of boredom, and I’ve recently encountered an issue that I can’t seem to untangle, I wanted to make the target get pushed whenever they get hit. Unfortunately, It doesn’t work.
I’ve tried the solution from this post:
"Dash Ability (LocalScript) > game.StarterPlayer.StarteplayerScripts"
Hitbox.Touched:connect(function(part)
if part:FindFirstAncestorOfClass("Model") and part:FindFirstAncestorOfClass("Model").Name ~= lclplr.Name then
if not part:FindFirstAncestorOfClass("Model"):FindFirstChild("Humanoid") then return end
if touchedAlready[part:FindFirstAncestorOfClass("Model").Name] then return end
touchedAlready[part:FindFirstAncestorOfClass("Model").Name] = part:FindFirstAncestorOfClass("Model")
if canslide == false then
game.ReplicatedStorage.GiveDamage:FireServer(part:FindFirstAncestorOfClass("Model"), script.Damage.Value)
local lookvector = cam.CFrame.LookVector
if lookvector then
game.ReplicatedStorage.pushAttacked:FireServer(lookvector)
end
coroutine.wrap(function()
lclplr.Character:WaitForChild("HumanoidRootPart").Anchored = true
wait(0.25)
lclplr.Character:WaitForChild("HumanoidRootPart").Anchored = false
end)()
end
end
end)
" GameHandler (ServerScript) > game.ServerScriptService"
rp.pushAttacked.OnServerEvent:Connect(function(player, lookvector)
if lookvector then
player.Character.HumanoidRootPart.AssemblyLinearVelocity = lookvector * 10000
end
end)
Demo Video:
External MediaP.S.: The dash itself works, its just that the target doesnt get pushed…
I’ll glady answer in more detail if nicely asked.