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 10 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:

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!

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

1 answer

Log in to vote
1
Answered by
haillin 60
10 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