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)
this needs two scripts, one local and one not local
not local script:
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() end end)
local script:
local proxPrompt = script.Parent.ProximityPrompt proxPrompt.Triggered:Connect(function(touched) if 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)