Just a quick question, right now i'm making a tool that multiples the damage you do by your strength number.

Server Script (The one that does the damage):

-------- wfmp

r = game:service("RunService")
local strength = script.Parent.StrengthValue
local damage = 0.03*strength.Value


local slash_damage = 0.06*strength.Value
local lunge_damage = 0.12*strength.Value

sword = script.Parent.Handle
Tool = script.Parent


function blow(hit)
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
	if hit.Parent:findFirstChild("Humanoid") and vCharacter:findFirstChild("Humanoid") and hit.Parent:findFirstChild("Humanoid") ~= vCharacter:findFirstChild("Humanoid") then
	local humanoid = hit.Parent:findFirstChild("Humanoid")
		tagHumanoid(humanoid, vPlayer)
		humanoid:TakeDamage(damage)
		wait(1)
		untagHumanoid(humanoid)
	end
end


function tagHumanoid(humanoid, player)
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end


function attack()
	damage = slash_damage
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end

function lunge()
	damage = lunge_damage


	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Lunge"
	anim.Parent = Tool
	swordOut()
	
	wait(.25)
	wait(.25)
	wait(.5)
	swordUp()

	damage = slash_damage
end

function swordUp()
	Tool.Handle.CanCollide = false
	Tool.GripForward = Vector3.new(-1,0,0)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(0,0,1)
	Tool.Handle.CanCollide = true
end

function swordOut()
	Tool.Handle.CanCollide = false
	Tool.GripForward = Vector3.new(0,0,1)
	Tool.GripRight = Vector3.new(0,-1,0)
	Tool.GripUp = Vector3.new(-1,0,0)
	Tool.Handle.CanCollide = true
end

function swordAcross()
	-- parry
end


Tool.Enabled = true
local last_attack = 0
function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	t = r.Stepped:wait()

	if (t - last_attack < .2) then
		lunge()
	else
		attack()
	end

	last_attack = t

	--wait(.5)

	Tool.Enabled = true
end


function onEquipped()
end


script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)


connection = sword.Touched:connect(blow)

The "Check" script that checks the strength of the player and puts it into a numbervalue called "StrengthValue":

repeat wait(0.1) until game.Players.LocalPlayer
while true do
	script.Parent.StrengthValue.Value = game.Players.LocalPlayer.leaderstats.Strength.Value
	wait(0.01)
end

If you have anymore question regarding any of this feel free to ask!

17 comments

0

'minimal damage' is expected if you have 0.03 as base, if you want 3 dmg you'd need 100 strength.value

0

so nothing wrong with the code? Ive been testing with 50 strength and its been doing almost nothing

0

also the lunge&slash damage bases are 0.12 and 0.06 so i dont see why it wouldnt be effective

0

0.03 * 50 = 1.5, thats NOTHING, you'd need ~67 hits in order to do 100 dmg with that

0

yeah then you have the lunge + slash damage which make up for that as i previously stated

0

Then what exactly is the problem you're trying to solve here..?

0

im testing it rn with 100+ strength and no damage is being delivered

0

also when i mean minimal damage i mean just the actual base, 0.03 and it doesnt get multiplied by anything. maybe that'll clear things up

0

If this dmg part you posted is read using a server script, and the strength.Value is updated from a localscript, the server wont notice the change.

0

how are you manipulating the value of StrengthValue? if you're making changes locally, it won't be replicated to the server, and it'll read it as the value that it's at serverside. if you're changing it in studio while you're viewing it from the client, it also won't replicate.

0

You basically only gave us a number. (damage = 3) I think your other code must be the problem b/c although the damage you are dealing is minimal it should be doing something. Can we see the rest of your code?

0

Oh i see, how would I update it from a localscript. (still trying to get into to the FE update.)

0

if it's a local value and you're reading it locally, then it'll update whenever either the server or the client changes it. if it's a serverside value, then it'll only update when the server changes. read up on RemoteEvents and RemoteFunctions

0

I did read about them and I understand the concept but i'm still learning on how I would do it with leaderstats.

0

'Cuz it doesn't update when the strength increases 'til the player respawns?

0

Can you show us the local script you are manipulating strength value with? I could Filtering Enabled-ify your script if you were to give me all scripts

0

making edits rn