I want to make a system that checks whether the player has the specific item, and if the player does, then the console would "work". However, the code didn't give me errors and it doesn't work.
Also, I don't really know how to exactly make a system that only destroys the tool if the player pressed the proximity prompt again. For now, it instantly destroys it if the player picks it up after pressing it. (Edit: turns out the textlabel also doesn't work for some reason)
local proxPrompt = script.Parent.ProximityPrompt
proxPrompt.Triggered:Connect(function(touched)
local backpack = touched:FindFirstChild("Backpack")
local backpackGame = backpack:WaitForChild("game")
if backpackGame then
backpackGame:Destroy()
elseif backpackGame == nil then
local cantInsertItemGui = game.StarterGui.CantInsertItemGui
local textLabel = cantInsertItemGui.TextLabel
textLabel.Visible = true
textLabel.Text = "you need a game to play on the console"
end
end)

7 comments
im not sure why your using WaitForChild instead of FindFirstChild but try putting an amount of seconds to wait for as a second parameter in WaitForChild because i think its infinitely yielding
The FindFirstChild fix worked for the everything before "elseif", thanks. (I didn't point out the textlabel was not working at first.)
oof I hate it when there is not a error.
is this local or not local?
xxaxxaz is once again wrong in his answer. the reason this doesnt work is because game.StarterGui isn't the playergui, StarterGui clones and goes in each player --> playergui. This explains no errors.
ah okay thanks, ill try it soon and hope it works
thanks everyone, the tips you gave me really helped with the script.