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

attempt to index global 'death' (a function value)?

Asked by 7 years ago

I'm trying to make a nuke that calls :BreakJoints() on humanoids in game. I keep getting this error though not sure what I'm doing wrong.

13:20:57.457 - Workspace.Brick.Script:23: attempt to index global 'death' (a function value) 13:20:57.457 - Stack Begin 13:20:57.458 - Script 'Workspace.Brick.Script', Line 23 13:20:57.458 - Stack End

01function Cough(Part)
02local fries = Instance.new('Message')
03fries.Parent = game.Workspace
04fries.Text = "Hello I will now explode"
05wait(3)
06fries:Destroy()
07local explosion = Instance.new('Part', game.Workspace)
08Part = explosion
09Part.Anchored = true
10Part.Shape = 'Ball'
11Part.Transparency = 0.1
12Part.TopSurface = "Smooth"
13Part.BottomSurface = "Smooth"
14Part.CanCollide = false
15while true do
View all 30 lines...

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

A function cannot be touched. Instead, a 3D part can be. Also, .Touched is not a property. I am going to rewrite the stuff.

01function Cough(Part)
02local fries = Instance.new('Message')
03fries.Parent = game.Workspace
04fries.Text = "Hello I will now explode"
05wait(3)
06fries:Destroy()
07local explosion = Instance.new('Part', game.Workspace)
08Part = explosion
09Part.Anchored = true
10Part.Shape = 'Ball'
11Part.Transparency = 0.1
12Part.TopSurface = "Smooth"
13Part.BottomSurface = "Smooth"
14Part.CanCollide = false
15while true do
View all 34 lines...
0
I am trying to do a check for if the part was touched by a humanoid. And if you can I cant figure out how to make the function happen once instead of happening thousands of times when you step on the brick. SacredEden 10 — 7y
0
Ohh ok hiimgoodpack 2009 — 7y
0
well do you know how i can fix it? xd SacredEden 10 — 7y
0
I DID I JUST MADE AN EDIT Ok? hiimgoodpack 2009 — 7y
View all comments (3 more)
0
bud i asked becuase you didn't fix it, OK? SacredEden 10 — 7y
0
DID YOU EVEN COPY THE NEW SCRIPT? hiimgoodpack 2009 — 7y
0
Yeah I did it still doesn't work for me. PLUS I already made a different version and that still doesn't work SacredEden 10 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

the "hum" at line 21 is useless, remove it. the touched event returns the part that touched it. so to check if a player has touched it, and has a humanoid then remove the death function and put this instead:

1death = function(part)
2    if part.Parent:FindFirstChild"Humanoid" then
3        part.Parent.Humanoid:BreakJoints()
4    end
5end

Answer this question