Attempted to index nil with parent [Solved]

The updated script:


local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptTriggered:Connect(function(prompt,player)

print("Clicked!")

local ItemClone = Item:Clone()

warn(ItemClone)

local backpack = player:WaitForChild("Backpack")

ItemClone.Parent = backpack

end)```

Yeah, thatā€™s what I expected, but itā€™s good to be 100% sure.

dont forget to check if the promt variable is the one you want

since this event is global if any promt is triggerd now this script will run.

edit: and may i ask what does the warn print? is it nil or an item?

1 Like

Yeah, I would check all of your variables with print statements just to make sure that they are all exactly what you think they are, including the item to clone, player, prompt, the actual clone, etc.

debugging can be real hard :joy: :sob:

Yes! I feel like you spend around 15% of the time actually coding and the remaining 85% of the time just debugging.

yes exactly, btw im curious how did you get the programmer tag? i want one aswell since im a programmer.

I donā€™t quite remember, Iā€™ll go check!

Okay. Go to this link and join any groups you want (you can join multiple!). Once youā€™ve joined the groups, go to your devforum profile preferences and you should be able to select a title and a flair of your choice!

Link: DevForum | Roblox

Just checked. No issues.

Error remains:

  20:49:07.591  Workspace.Model.Lemon.ProximityPrompt.GiveScript:7: attempt to index nil with 'Parent'  -  Server - GiveScript:7
  20:49:07.591  Stack Begin  -  Studio
  20:49:07.592  Script 'Workspace.Model.Lemon.ProximityPrompt.GiveScript', Line 7  -  Studio - GiveScript:7
  20:49:07.592  Stack End  -  Studio

I might change this to [UNSOLVEABLE] lol

Thereā€™s no problem with not using proxymitypromtservice
https://developer.roblox.com/en-us/api-reference/event/ProximityPrompt/Triggered

The issue is the item isnā€™t getting detected. Does the ItemClone prints?
Studio gets buggy sometimes and restarting the studio do the trick.

1 Like

It prints nil even though both the server and the client sees itā€™s there.

Please use heart next time, thatā€™s against the rules.

Are you sure that the Item exist in the replicatedstorage?

Yep, itā€™s there, it even autofills.

I donā€™t see any problem in here, maybe its a roblox studio thing.It might work after you restart studio.

Error remains as it is. I think it might actually be fitting to change the title/topic to, ā€œUNSOLVEABLEā€

Iā€™ve looked though all the fixes again, itā€™s a studio bug. Thereā€™s nothing else we can do.

If you think there is something else we can do, then go for it, other than that, Iā€™ll have to shut down my bakery because everything is essentially non-functional because of this stupid bug.