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

How do I make punching damage increase according to leaderstats? [closed]

Asked by 6 years ago

I made the punch but how do you make the damage increase on the increase of leaderstats? My leaderstats is "Pounds". So like if you have 50 pounds how do you make the damage increase? The following script is the punch script in ServerScriptStorage :

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage)
03punchEvent.Name = "PunchEvent"
04 
05local animations = {2837703681, 2837724814}
06local function onPunchFired(plr)
07    local char = game.Workspace:FindFirstChild(plr.Name)
08    local humanoid = char.Humanoid
09    local animation = Instance.new("Animation")
10    local picked = math.random(1, #animations)
11    animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
12    local animTrack = humanoid:LoadAnimation(animation)
13    animTrack:Play()
14    local dmgScript = script.DmgScript:Clone()
15    if picked == 1 then
View all 25 lines...

his is the damage script inside of the punch script and as said I need help increasing the damage on the increase of Pounds.

01script.Parent.Touched:Connect(function(hit)
02    local char = hit.Parent
03    local hum = char:FindFirstChild("Humanoid")
04    if hum and char.Name ~= script.Parent.Parent.Name then
05        hum.Health = hum.Health - 10
06        script.Disabled = true
07        wait(0.5)
08        script.Disabled = false
09    end
10end)

Here is the LocalScript to tell what key to press to punch in StarterCharacterScripts:

01local UserInputService = game:GetService("UserInputService")
02local ReplicatedStorage = game:GetService("ReplicatedStorage")
03local punchEvent = ReplicatedStorage:WaitForChild("PunchEvent")
04 
05local ready = true
06 
07local function punch(inputObject, gameProcessed)
08    if inputObject.KeyCode == Enum.KeyCode.Q and ready then
09        punchEvent:FireServer()
10        ready = false
11        wait(0.5)
12        ready = true
13    end
14end
15 
16UserInputService.InputBegan:Connect(punch)
0
Before the damage script I put his is the damage script, i meant Here is the damage script. ChefDevRBLX 90 — 6y

Closed as Not Constructive by User#24403

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?