Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you disable the visibility of the prompt locally when the player is seated?

I tried to add more seats to my vehicle and the fact that CanCollide is enabled, I have to use ProximityPrompts. Problem is that when I take a seat, the prompts of the other seats show up and I tried to disable it locally. But my code didn't work since I don't know how events work. There was another solution by getting all children and make Instance.Enabled false, but I don't know how to make it do so.

LocalScript code:

local promptService = game:GetService("ProximityPromptService")
local UserInputService = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

function onSeated(isSeated, seat)
	if isSeated then
		promptService.PromptHidden = true
	else
		promptService.PromptHidden = false
	end
end
humanoid.Seated:Connect(onSeated)

1 answer

✓ Accepted answer

I think this should work. Your code didn't work because PromptHidden is an Event.

Place this LocalScript in StarterCharacterScripts

local promptService = game:GetService("ProximityPromptService")
local UserInputService = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

function onSeated(isSeated, seat)
	if isSeated then
		promptService.Enabled = true
	else
		promptService.Enabled = false
	end
end
humanoid.Seated:Connect(onSeated)

3 comments

0

It didn't work...

0

changed my mind, I managed to fix it

0

No problem

This discussion is preserved as it was. New answers, comments, and votes are closed.