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

How could this be fixed? [Please HELP!]

Asked by 11 years ago

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:

1if LeftButtonDownTime and currTime - LeftButtonDownTime > Start(THROW) and--WHATS WRONG?
2currTime - LeftButtonDownTime < 1.15 then
3ThrowAttack()
01function Start()
02if Game.Players.LocalPlayer.PlayerGui.Default.Value == true then
03SLASH_DAMAGE = 25
04DOWNSTAB_DAMAGE = 25
05Damage = 25
06SPEED = 85
07THROW = 0.38
08elseif Game.Players.LocalPlayer.PlayerGui.Upgrade2.Value == true then
09SLASH_DAMAGE = 30
10elseif Game.Players.LocalPlayer.PlayerGui.Upgrade3.Value == true then
11DOWNSTAB_DAMAGE = 30
12elseif Game.Players.LocalPlayer.PlayerGui.Upgrade4.Value == true then
13Damage = 30
14elseif Game.Players.LocalPlayer.PlayerGui.Upgrade5.Value == true then
15SPEED = 100
View all 24 lines...
1--EXAMPLE:
2function Blow(hit)
3    if Attacking then
4        BlowDamage(hit, Start(Damage))--IS THIS RIGHT?
5    end
6end

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

0
You never added the parameter "THROW" in the Start() function. Lacryma 548 — 11y

1 answer

Log in to vote
1
Answered by
haillin 60
11 years ago

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.

Ad

Answer this question