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
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.
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
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)
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!
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!