You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? So, each seat in the vehicle I’m making, including the driver one, has a ProximityPrompt inside which I want to disable only for the player if they enter a seat (any seat, doesn’t matter if it’s for the driver) and I don’t know what I should do, I tried using RemoteEvents but LocalScripts don’t run in the Workspace
What is the issue? I tried using RemoteEvents, but I can’t run them locally because of being in the Workspace
What solutions have you tried so far? I haven’t found anything that helps me with that in the DevForum
Why not use Collectionservice to tag the player that is on the seat on the server then use collection service on the client to validate whether the player on the seat matches the local player then disable all the proximity prompts.
Hi again, could you provide me with some example of how I could use the CollectionService for that? I really haven’t worked with it before, thanks in advance
It should be structured similar to this but if you have problems accessing the prompts then change the object your looking for to the vehicle so a model then just look through the model for the parts.
local CollectionService = game:GetService("CollectionService")
local tag = "SeatTag" --write your own tag name
-- Store the connections so they can be disconnected when the tag is being removed
local connections = {}
local function onInstanceAdded(object)
-- Confirm that the object with this tag is a Vehicleseat.
if object:IsA("VehicleSeat") then --this can be your vehicle model either
connections[object]=true
-- write code to disable prompts
end
end
local function onInstanceRemoved(object)
if connections[object] then
connections[object] = nil
--write code to enable prompts for the player
end
end
-- Detect for this tag being applied to objects
CollectionService:GetInstanceAddedSignal(tag):Connect(onInstanceAdded)
CollectionService:GetInstanceRemovedSignal(tag):Connect(onInstanceRemoved)
-- Lisent for any objects that already have the tag
for _, object in pairs(CollectionService:GetTagged(tag)) do
onInstanceAdded(object)
end