Trouble with "item picked up message system" with more than one tool

I’m trying to make it so that when you can pick-up multiple objects in my game, a message saying"you picked up an item" appears when a proximity prompt triggers a remote event in replicated storage. But for some reason, the message only appears for one item, and the other 2 items don’t display a message when picked up.

local ProximityPrompt = script.Parent.ProximityPrompt
local Key3 = script.Parent.Parent
local Collect = script.Parent.Collect

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	script.Parent.ProximityPrompt.Enabled = false
	game.ReplicatedStorage.YellowKeyEvent:FireClient(player)
	local backpack = player:WaitForChild("Backpack")
	Key3.Parent = backpack
	script.Parent.Collect:Play()
	ProximityPrompt:Destroy()
end)

game.StarterGui.Keys.Frame.Text3.Fade.Disabled = false

Screenshot_238

Screenshot_239

Are your names labeled correctly in the script ? If each key has a different name, are you reflecting that name in the script ?

BlueKeyEvent
RedKeyEvent
YellowKeyEvent
Text1
Text2
Text3

1 Like

@CaptchaSolverV3

clone it instead of parenting the actual instance

1 Like

Yes I labeled everything correctly but I reckon it might be a backpack issue

How would I do that? (I’m still learning LUA so there’s a lot of things I still don’t know)

Key3:Clone().Parent = backpack

1 Like

What about this?

local ProximityPrompt = script.Parent.ProximityPrompt
local Key3 = script.Parent.Parent
local Collect = script.Parent.Collect

ProximityPrompt.Triggered:Connect(function(player)
	ProximityPrompt:Destroy()
	Collect:Play()
	game.ReplicatedStorage.YellowKeyEvent:FireClient(player)
	local backpack = player:FindFirstChild("Backpack")
	Key3.Parent = backpack
	
	--Ideally, this should actually be done through a RemoteEvent where the client enables the GUI
	--Not sure what YellowKeyEvent does, but you could move this into there?
	local gui = player:FindFirstChild("PlayerGui")
	gui.Keys.Frame.Text3.Fade.Disabled = false
end)

The game.StarterGui.Keys.Frame.Text3.Fade.Disabled = false code you had will only disable the GUI for new players, as StarterGui is used to store GUIs that are cloned to players when they join or possibly respawn. You should be using a container known as PlayerGui, which is a parent of Player (similarly to Backpack), to modify GUIs of players.

1 Like

I tried this and it seems very strange as I am making a horror game and there’s only one model of each key and the message doesn’t appear for any of them with this script

Im no scripter but what I do know is that GFX artists aren’t needed for this :smile:

1 Like

Ohh shoot my bad lemme change that

No problem, it’s a good question though.

1 Like

The yellowkeyevent basically triggers a localscript inside the actual textlabel itself

game.ReplicatedStorage.RedKeyEvent.OnClientEvent:Connect(function()
	script.Parent.Visible = true
end)

By the way ^^ that is a local script

ill give you a similar place file
help2.rbxl (34.7 KB)

1 Like

You could try this then, for the yellow key tool Script:

local ProximityPrompt = script.Parent.ProximityPrompt
local Key = script.Parent.Parent
local Collect = script.Parent.Collect

local KeyEvent = game:GetService("ReplicatedStorage"):FindFirstChild("YellowKeyEvent")

ProximityPrompt.Triggered:Connect(function(player)
	local backpack = player:FindFirstChild("Backpack")
	Collect:Play()
	ProximityPrompt:Destroy()
	Key.Parent = backpack
	--or Key:Clone().Parent = backpack, depending on if you want the key to disappear from the world
	KeyEvent:FireClient(player)
end)

and the yellow key GUI LocalScript:

local KeyEvent = game:GetService("ReplicatedStorage"):FindFirstChild("YellowKeyEvent")

KeyEvent.OnClientEvent:Connect(function()
	script.Parent.Visible = true
	script.Parent.Fade.Disabled = false
end)
1 Like

Yes but this is what happens in my place:

Note: It wouldn’t let me upload the video file here for some reason

may i know?, you have script like this in each tool that fires different remotes right?
the yellow one seems to work fine it should be the other two scripts that has the problem!
also scripts won’t function when disabled
under text2 there is a disabled fade text!

1 Like

I was able to fix it! All I did was add this line of code:

local gui = player:FindFirstChild("PlayerGui")
	gui.Keys.Frame.Text1.Visible = true

Thanks to everyone who tried their best to help with this situation, this must’ve been the hardest issue I’ve ever faced and I couldn’t have solved it without you guys!