I’ve run into this issue with this very simple script that I can’t seem to wrap my head around. I can easily go around the problem but I just want to understand what’s going on here.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cashTableBoughtEvent = ReplicatedStorage.CashTableBought
local bank = script.Parent.Parent.Parent.Parent
print("Event called")
cashTableBoughtEvent:Fire(bank)
The error in the output is:
Workspace.Banks.Bank1.Vault.Table.Button.EventFireScript:4: attempt to index nil with ‘Parent’
Here I just have a script that’s disabled. It is later enabled and it is meant to fire a remote event. But it just doesn’t like to use the term Parent. I’ve tried replacing line 4 with “local bank = workspace.Banks.Bank1” (getting the instance through the workspace instead of from the script) and it works just fine. Why did Studio react this way? Did roblox do something to the Parent keyword or what?