Local Proximity prompts

i am currently making a game that requires proximity prompt quests, I have been trying to make a proximity prompt that when triggered makes the item disappear only for the player that triggered it and a door that also disappears when triggered for the local player but just don’t know how. this was my current script in serverscriptservice

local plr = game:GetService(“Players”).LocalPlayer

game.Workspace.Key.ProximityPrompt.Triggered:Connect(function(plr)

plr.PlayerGui.GotKey.Value = true

plr.PlayerGui.ScreenGui.Enabled = true

wait(1)

game.Workspace.Key:Destroy()

plr.PlayerGui.ScreenGui.Enabled = false

end)

1 Like

You could have a remote event that is fired to the player when they trigger the prompt and in the local script handling the event, you could then destroy the things you want to destroy

i have added in a remote event and my part i want to be destroyed is called Key how would i write my script to fire the event and destroy the key as i am a rookie at scripting

in a server script, you can create an event that handles the prompt being triggered (using the “ProximityPrompt.Triggered” event) which will give you the player who triggered it as the first parameter. You can then fire the remote event to the player

ok i will attempt to create this

i didnt quite understand what i have to do

ok here
local script: connect to proximity prompt triggered and destroy the key and delete door or something

2 Likes

I wasnt quite sure what you are trying to do here, hopefully I understood well enough for this to help you. Also sorry for this late reply. not sure if your problem has been resolved

--- LocalScript inside of StarterPlayerScripts
local proximityPromptService = game:GetService("ProximityPromptService")

proximityPromptService.PromptTriggered:Connect(function(prompt, player)
    if prompt.Name == "Quest1" then -- Or whatever the prompt's name you want to use. if you don't have this if statement then any prompt could trigger this script
        local door = game.Workspace.Door -- Path to where ever your door is
        local key = game.Workspace.Key
        player.PlayerGui.GotKey.Value = true
        player.PlayerGui.ScreenGui.Enabled = true
        ---
        task.wait(1)
        ---
        door:Destroy()
        key:Destroy()
        plr.PlayerGui.ScreenGui.Enabled = false
    end
end)
1 Like

thanks alot, i now understand how it works

1 Like