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

How could this be fixed? [Please HELP!]

This is suppose to detect your value and if its true it changes the damage of or speed of the weapon. Ill give an example of what i attempt.

The Error i get is: attempt to compare nil with a number. The line i get the error is:

if LeftButtonDownTime and currTime - LeftButtonDownTime > Start(THROW) and--WHATS WRONG?
currTime - LeftButtonDownTime < 1.15 then
ThrowAttack()
function Start()
if Game.Players.LocalPlayer.PlayerGui.Default.Value == true then
SLASH_DAMAGE = 25
DOWNSTAB_DAMAGE = 25
Damage = 25
SPEED = 85
THROW = 0.38
elseif Game.Players.LocalPlayer.PlayerGui.Upgrade2.Value == true then
SLASH_DAMAGE = 30
elseif Game.Players.LocalPlayer.PlayerGui.Upgrade3.Value == true then
DOWNSTAB_DAMAGE = 30
elseif Game.Players.LocalPlayer.PlayerGui.Upgrade4.Value == true then
Damage = 30
elseif Game.Players.LocalPlayer.PlayerGui.Upgrade5.Value == true then
SPEED = 100
SLASH_DAMAGE = 50
DOWNSTAB_DAMAGE = 50
Damage = 50
elseif Game.Players.LocalPlayer.PlayerGui.Upgrade7.Value == true then
SPEED = 125
elseif Game.Players.LocalPlayer.PlayerGui.Upgrade8.Value == true then
THROW = 0.19
end
end
--EXAMPLE:
function Blow(hit)
	if Attacking then
		BlowDamage(hit, Start(Damage))--IS THIS RIGHT?
	end
end

THEIR ARE MORE FUNCTIONS BUT I JUST GAVE YOU AND EXAMPLE!

1 comment

0

You never added the parameter "THROW" in the Start() function.

1 answer

✓ Accepted answer

I think elseif negates the original if statement. elseif will do something if the first condition is not met so I think your

elseif Game.Players.LocalPlayer.PlayerGui.Upgrade2.Value == true then

SLASH_DAMAGE = 30

only sets SLASH_DAMAGE and not the other values as well.

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