My friend and I are creating a game similar to Slap Battles, and we would like them to get kickbacked based on the power of the glove.
We have a bunch of dummies/npcs on the map, and we are able to kick them back. The kickback works differently due to the level of intensity of the glove. These features all work on the dummies, but not on a actual player in the live game.
I have tried using the amiation we use for the dummies on the actual player and I have checked to see if the glove is making contract with my player.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
The script below is the HitHandler, which triggers what happens when the player is hit.
local Tool = script.Parent.Parent
local Anim = script:WaitForChild("Animation")
local AnimTrack
local hitChars = {}
local debounce = false
Tool.Activated:Connect(function()
if debounce then
return
end
debounce = true
local humanoid = Tool.Parent.Humanoid
if not AnimTrack then
AnimTrack = humanoid:LoadAnimation(Anim)
end
AnimTrack:Play()
wait(2.5)
debounce = false
end)
Tool.Hitbox.Touched:Connect(function(hit)
if hitChars[hit.Parent] or not debounce then
return
end
if hit.Parent:FindFirstChild("Humanoid") then
local eChar = hit.Parent
local plrChar = Tool.Parent
local eHumanRootPart = eChar:FindFirstChild("HumanoidRootPart")
local plrHumanRootPart = plrChar:FindFirstChild("HumanoidRootPart")
if plrHumanRootPart and eHumanRootPart then
script.Disabled = true
eChar.Humanoid.Sit = true
local force = Instance.new("BodyVelocity", eHumanRootPart)
force.MaxForce = Vector3.new(2,2,2) * math.huge
local direction = (eHumanRootPart.CFrame.Position - plrHumanRootPart.CFrame.Position).Unit
force.Velocity = (direction + Vector3.new(0,1,0)).Unit * 25
local rotation = Instance.new("BodyAngularVelocity", eHumanRootPart)
rotation.AngularVelocity = Vector3.new(1,1,1) * math.pi * math.random(1,5)
rotation.MaxTorque = Vector3.new(2,2,2) * math.huge
rotation.P = 5000
wait(0.35)
force:Destroy()
rotation:Destroy()
eChar.Humanoid.Sit = false
local player = game.Players:GetPlayerFromCharacter(Tool.Parent)
player.leaderstats.Slaps.Value = player.leaderstats.Slaps.Value + 1
end
hitChars[hit.Parent] = true
wait(2.5)
script.Disabled = false
hitChars[hit.Parent] = nil
end
end)
A video is displayed below of me slapping a dummy and me slapping an actual player. The kickback on the dummy works properly, but doesn’t work at all on the actual player.
kickback working on npc: kickback working on npc - YouTube
kickback not working on actual player: kickback not working - YouTube