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

Any Know How To Make My DMG Based On My Strength Leader Stat?

Asked by 4 years ago

So For EX. Perhaps My Strength Is 1. I Would Want To Do 1 DMG. Any One Know How To Do That?

local remoteEvent = game.ReplicatedStorage.OnSuccessfulHit


remoteEvent.OnServerEvent:Connect(function(plr, humanoidHit)


    humanoidHit:TakeDamage(10)

end)

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You can fire the amount of strength the player has to the server.

For example:

--LocalScript that fires
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("MyEvent")
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local Strength = leaderstas.Strength --Your strength value within the leaderstats

RemoteEvent:FireServer(humanoidHit,Strength.Value)

Now that we are giving the event the amount of damage the player can do, what we can do is:

--ServerScript
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("MyEvent")

RemoteEvent.OnServerEvent:Connect(function(player,humanoidHit,StrengthValue)
    humanoidHit:TakeDamage(StrengthValue)
end)
0
So In The Local Script humanoidHit Is Mark As A Unknown Variable Proskillez342 9 — 4y
0
well, you didn't provide the LocalScript so I'm assuming you're passing the humanoid that has been hit as a parameter? AntoninFearless 622 — 4y
Ad

Answer this question