How do i create a local proximity promt?

I want a proximity promt that can appear to one player (Like, if one player goes and activate it, other players can activate it too but without affecting other player’s promts)

I am working on a game called Humans and Shadows and there is a knife that you will be able to pick up and stab a painting to get a secret ability but the proximity promts shows to everyone in the server (A problem since the painting promt shows after someone picks up the knife and everyone can activate the stab proximity promt)

pick up promt
Captura de tela 2023-02-05 122317

stab promt

I have already looked all over the place for a solution (Youtube, dev forum and discord)

I have already seen parts moving for only one player so i think i can do the same with the kinfe that disappears when you pick it up and sorry if this is a stupid question but i can’t find the solusion anywhere. thanks if anyone can help

I think i shoud say that i am not so good with script in general so i can’t really undertand complicated scripts but i’ll try my best to

To achieve this, you could create a script that assigns a unique identifier to each player who interacts with the knife, and then only displays the proximity prompt for players who have that identifier. You can use a data store, like a DataStoreService or a RemoteEvent, to store the identifiers and check which players have already interacted with the knife. The script could look something like this:

-- Script for the knife
local DataStoreService = game:GetService("DataStoreService")
local playersDataStore = DataStoreService:GetDataStore("playersDataStore")

local function onActivate(player)
    -- Get player's identifier from the data store
    local playerId = playersDataStore:GetAsync(player.UserId)
    if not playerId then
        -- If the player doesn't have an identifier, assign one
        playerId = math.random(100000, 999999)
        playersDataStore:SetAsync(player.UserId, playerId)

    -- Show the proximity prompt only to players with the same identifier
    local otherPlayers = game.Players:GetPlayers()
    for _, otherPlayer in ipairs(otherPlayers) do
        if playersDataStore:GetAsync(otherPlayer.UserId) == playerId then
            -- Show the proximity prompt for players with the same identifier
            -- ...

-- Connect the activation function to the knife's TouchEnded event
local knife = script.Parent -- Replace this with the actual knife object

This is just a basic example, and you may need to modify it to fit your specific game and requirements.

1 Like