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

A script that damages a humanoid. Increases damage based on each level, not working?

So in this script (located in server script service) is supposed to increase your damage based on each level. The damage works, but the damage value doesn't increase.

PROBLEM: Damage Value does not increase on each level.

Someone help ?

This is FE.

local ServerStorage = game:GetService('ServerStorage')
local strength = ServerStorage.Values:FindFirstChild('Strength').Value

script.Parent.Touched:Connect(function(hit)
	local DmgValues = {script.Dmg.Value, script.DmgCritical.Value, script.Dmg2.Value, script.Dmg3.Value, script.DmgCritical2.Value}
	local char = hit.Parent
	local hum = char:FindFirstChild("Humanoid")
	local chance = math.random(1, #DmgValues)
	
	if strength == strength*1 then
		script.Dmg.Value = script.Dmg.Value + 1
		script.DmgCritical.Value = script.Dmg.Value + 2
		script.Dmg2.Value = script.Dmg.Value + 1
		script.DmgCritical2.Value = script.Dmg.Value + 2
		script.Dmg3.Value = script.Dmg.Value + 1
	end
		if hum and char.Name ~= script.Parent.Parent.Name then
		hum.Health = hum.Health - DmgValues[chance]
		script.Disabled = true
		wait(0.5)
		script.Disabled = false
	end
	end)


5 comments

0

I dont get what your trying to do in your code. Strength == strength * 1? thats always going to be true. How much do you want the damage to raise per level.

0

strength is actually the name of the level

0

if you say script.Disabled = true it stops and wont be able to become false again unless done by another script that is why it wont work.

0

LMAO ur making weight lifting simulator 3

0

no lol im making a fighting anime game

1 answer

Try this:

local CanTouch = true


local ServerStorage = game:GetService('ServerStorage')
local strength = ServerStorage.Values:FindFirstChild('Strength').Value

script.Parent.Touched:Connect(function(hit)
if CanTouch == true then
    local DmgValues = {script.Dmg.Value, script.DmgCritical.Value, script.Dmg2.Value, script.Dmg3.Value, script.DmgCritical2.Value}
    local char = hit.Parent
    local hum = char:FindFirstChild("Humanoid")
    local chance = math.random(1, #DmgValues)

    if strength == strength*1 then
        script.Dmg.Value = script.Dmg.Value + 1
        script.DmgCritical.Value = script.Dmg.Value + 2
        script.Dmg2.Value = script.Dmg.Value + 1
        script.DmgCritical2.Value = script.Dmg.Value + 2
        script.Dmg3.Value = script.Dmg.Value + 1
    end
        if hum and char.Name ~= script.Parent.Parent.Name then
        hum.Health = hum.Health - DmgValues[chance]
CanTouch = false
wait(.5)
CanTouch = true
    end
else 
wait(.5)
CanTouch = true
end
    end)


I just added a variable

1 comment

0

the increasing part doesnt work but the damage is still working @greatneil80

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