ZDH_Dev
(ZDH_Dev)
April 6, 2021, 10:07pm
#1
Hello reader! For the past few days, I have been getting this
I am not the most experienced with scripting, so that might be the issue. I have looked up what the error message means, and I think it might be a bug, but I’m not sure. Thanks for reading!
1 Like
Galactiq
(Matthew)
April 6, 2021, 10:09pm
#2
Change Dummy:Destroy()
to workspace.Dummy:Destroy()
This happens because “Dummy” was never defined, and the compiler thinks you are addressing a nonexistent variable.
4 Likes
ZDH_Dev
(ZDH_Dev)
April 6, 2021, 10:15pm
#3
Right when I test it, both the dummy and the door disappear. Is that supposed to happen?
Yea, you called the Destroy
method on them.
1 Like
ZDH_Dev
(ZDH_Dev)
April 6, 2021, 10:16pm
#5
Ok, I’m trying to make it so that when the player kills the dummy, the door disappears. Probably should have said that in the post
RFL890
(GeorgeCatherington)
April 6, 2021, 10:17pm
#6
script in a dummy:
script.Parent.Humanoid.Died:Connect(function()
workspace.Door:Destroy()
script.Parent:Destroy()
end)
2 Likes
There is no variable named “Dummy” in your script.
1 Like
ZDH_Dev
(ZDH_Dev)
April 6, 2021, 10:19pm
#8
Ok, I see. Thanks for telling me
game.Workspace.Dummy.Humanoid.Died:Connect(function()
workspace.Door:Destroy()
end)
1 Like
Also if you want to you can make it a global using
_G
1 Like
ZDH_Dev
(ZDH_Dev)
April 6, 2021, 10:20pm
#11
That makes the dummy disappear on death (which is still useful, thanks). I’m trying to make the door disappear when the dummy dies
ZDH_Dev
(ZDH_Dev)
April 6, 2021, 10:22pm
#12
Oh wait nvm, It worked. Thanks a ton!
RFL890
(GeorgeCatherington)
April 6, 2021, 10:22pm
#13
So just delete the line of code destroying it.
You’re welcome!
1 Like
RFL890
(GeorgeCatherington)
April 6, 2021, 10:24pm
#14
In this scenario, using _G to define the dummy would have no use, since you can just as easily do
local Dummy = workspace:WaitForChild('Dummy')
, and it would be about 30% faster (according to roblox)
1 Like