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

Attempt to connect failed: Passed value is not a function?

Asked by 6 years ago

I'm having a bit of trouble seeing what exactly is wrong with my script. It looks completely fine to me but it doesn't work because I can't get the function to fire off because it says that my function (hurtcalc) is apparently not defined.

Here is the code (it's a globalscript) and thank you in advance for helping me.

01local Tool = script.Parent.Parent
02swing1 = Tool:FindFirstChild("attackState1")
03swing2 = Tool:FindFirstChild("attackState2")
04aerial = Tool:FindFirstChild("aerialstate")
05boxActive = Tool.boxActive
06 
07hurt = script.Parent.damage.Value
08 
09 
10 
11local function onTouched(hit)
12    while boxActive.Value == true do
13        if hit.Parent:findFirstChild("Humanoid") then
14            hit.Parent["Humanoid"]:TakeDamage(hurt.Value)
15            wait()
View all 37 lines...

1 answer

Log in to vote
0
Answered by
aschepler 135
6 years ago

You have misplaced end keywords. So your hurtcalc is actually local to the definition of onTouched, where it doesn't get used or called, and then hurtcalc is out of scope at the last line of the script.

Add another end after the onTouched logic, and remove one end after the hurtcalc logic.

Ad

Answer this question