I’m working on a prompt system for my modified a-chassis. I want it so when a player enters a seat in the car it disables the prompt in the seat they are sitting in, and then I have a LocalScript that is supposed to disable all the seat prompts on their client side so they can’t see the other prompts in the car.
The ServerScript is working but the LocalScript doesn’t disable the prompts
ServerScript:
local passengerSeats = script.Parent
local driverSeat = script.Parent.Parent.Parent:FindFirstChild("DriveSeat")
local PromptHide = Instance.new("RemoteEvent")
PromptHide.Name = "SeatsPrompt"
PromptHide.Parent = game:GetService("ReplicatedStorage").CarSystem.Events
-- Function to disable the prompt inside the seat when a player sits in it
local function DisableSeatPrompt(seat)
local prompt = seat:FindFirstChild("ProximityPrompt")
if prompt then
prompt.Enabled = false
end
end
-- Passenger Seats
for _, seat in ipairs(passengerSeats:GetChildren()) do
if seat:IsA("Seat") then
local prompt = seat:FindFirstChild("ProximityPrompt")
if prompt then
prompt.Triggered:Connect(function(player)
if seat.Occupant == nil then
seat:Sit(player.Character.Humanoid)
prompt.Enabled = false
PromptHide:FireClient(player)
end
end)
end
end
end
-- Driver Seat
local driverPrompt = driverSeat:FindFirstChild("ProximityPrompt")
if driverPrompt then
driverPrompt.Triggered:Connect(function(player)
if driverSeat.Occupant == nil then
driverSeat:Sit(player.Character.Humanoid)
driverPrompt.Enabled = false
PromptHide:FireClient(player)
end
end)
end
LocalScript:
local PromptHide = game:GetService("ReplicatedStorage").CarSystem.Events.SeatsPrompt
-- Listen to the HidePrompts event from the server and disable all seat prompts on the client
PromptHide.OnClientEvent:Connect(function(player)
for _, seat in ipairs(passengerSeats:GetChildren()) do
if seat:IsA("Seat") then
local prompt = seat:FindFirstChild("ProximityPrompt")
if prompt then
prompt.Enabled = false
end
end
end
end)