You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want the script to update all my part’s proximity parts
What is the issue? The script is only updating 1 proximity part
What solutions have you tried so far? I tried to debug this issue
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local SoundService = game:GetService("SoundService")
local SoundId = "rbxassetid://2978605361"
local sound = game.SoundService.Sound
for i, ProximityPrompt in pairs(game.Workspace.MISIC.Part:GetChildren("ProximityPrompt")) do
if ProximityPrompt:IsA("ProximityPrompt") then
ProximityPrompt.Enabled = true
ProximityPrompt.KeyboardKeyCode = Enum.KeyCode.B
ProximityPrompt.Triggered:Connect(function()
ProximityPrompt.ActionText = "Hold B to Break In!"
print("The Prompt has been trigged!")
end)
end
end
print("made it to the end")
So i got a problem where my script is only updating 1 proximity prompt and not the rest of the scripts proximity prompts the parts are in the folder and the children are the proximity prompts for all parts
Your script detects only one part called “Part”, since that name is also the ClassName of a part. Try re-naming your parts.
Also, GetChildren() should be empty, you need to get the children of your folder and for each child there, get the child of that child - the proximity.
the problem is that you are going through 1 part. Fix it by going through all of the parts in the folder.
local SoundService = game:GetService("SoundService")
local SoundId = "rbxassetid://2978605361"
local sound = game.SoundService.Sound
for i, part in pairs(game.Workspace.MISIC:GetChildren()) do
if not part:FindFirstChildOfClass("ProximityPrompt") then return end
local ProximityPrompt = part:FindFirstChildOfClass("ProximityPrompt")
ProximityPrompt.Enabled = true
ProximityPrompt.KeyboardKeyCode = Enum.KeyCode.B
ProximityPrompt.Triggered:Connect(function()
ProximityPrompt.ActionText = "Hold B to Break In!"
print("The Prompt has been trigged!")
end)
end
print("made it to the end")