Is there a way to add Proximity Prompts to objects using code? Reason is, I don’t want users to be able to interact with the objects until a certain time has passed.
So I have objects in this folder:
game.workspace.Objects;
And I would like to go through a for-loop to add a proximity prompt to each. Also, are proximity prompts good for only server use (so that client-side exploiters can’t abuse it)?
Simply use Instance.new(“ProximityPrompt”). To answer your other question, yes you can use proximity prompts on the server using ProximityPrompt.Triggered. So really all you need to do is set ProximityPrompt.Enabled To false and use the triggered event on the server.
local ObjectsFolder = workspace.Objects
local function AddPrompts()
for _, Object in ipairs(ObjectsFolder:GetChildren()) do
local Prompt = Instance.new("ProximityPrompt")
Prompt.Parent = Object
end
end
task.delay(10, AddPrompts) --change 10 to length of time which should elapse before the function is executed