Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

2 comments

0

So In The Local Script humanoidHit Is Mark As A Unknown Variable

0

well, you didn't provide the LocalScript so I'm assuming you're passing the humanoid that has been hit as a parameter?

This discussion is preserved as it was. New answers, comments, and votes are closed.