Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a killstreak like slap battles??

Asked by 2 years ago

You know, the one that slap battles have. Where you kill an enemy, your killstreak number will pop up on top of your head. So if i were to slap someone off the edge, the killstreak number would go as 1. Same for someone if they reset. Now, i dont know how to code but I have a free model that has alot of scripting and I want you guys to verify if that is the right scripting or not or if I just need to fix it.

local cooldown = 0.7

activated = false deb = false slapped = false local slapanim

script.Parent.Equipped:Connect(function() slapanim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.SlapAnim) end) script.parent.Activated:Connect(function() if activated == false and deb == false then deb = true activated = true slapanim:Play() wait(0.3) activated = false wait(cooldown-0.3) slapped = false deb = false end end) script.Parent.Hand.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChildWhichIsA("Humanoid") local no = false script.Parent.Unequipped:Connect(function() return end) if activated == true and slapped == false and hit.Parent:FindFirstChild("Humanoid") and hit.Parent ~= script.Parent.Parent then slapped = true local player = game:GetService("Players")
local myself = script.Parent.Parent.Name local findmyself = player:FindFirstChild(myself) script.Parent.GetKillValueChanged.Disabled = false hit.Parent.Humanoid.Died:Connect(function() script.Parent.GetKill.Value = true wait(0.2) script.Parent.GetKill.Value = false end) script.Parent.Hand.Slap:Play() hit.parent.Ragdoll.Value = true local char = game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent) script.Parent.Deaths.Value = script.Parent.Deaths.Value

    local slap =  game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent):FindFirstChild("leaderstats"):FindFirstChild("Slaps")

slap.Value = slap.Value + 1 local velocity = Instance.new("BodyVelocity",hit.Parent.HumanoidRootPart) velocity.MaxForce = Vector3.new(3,3,3) * math.huge local dir = (hit.Parent.HumanoidRootPart.CFrame.Position - script.Parent.Parent.HumanoidRootPart.Position).Unit velocity.Velocity = (dir + Vector3.new(0,1,0)).Unit *script.Parent.Power.Value local rot = Instance.new("BodyAngularVelocity",hit.Parent.HumanoidRootPart) rot.AngularVelocity = Vector3.new(1,2,1) * math.pi *5 rot.MaxTorque = Vector3.new(2,5,2) *math.huge rot.P = 5000 game:GetService("Debris"):AddItem(velocity, 0.5) game:GetService("Debris"):AddItem(rot,0.5) wait(0.8) -- remove this no = false wait(0.8) script.Parent.GetKillValueChanged.Disabled = true

end

end)

Answer this question