local ProximityPromptService = game:GetService("ProximityPromptService")
local function onPromptTriggered(promptObject, player)
print("Triggered")
if player == script.Parent.Parent.Parent.Parent.Owner then
print("Hopefully triggered")
seat:Sit(player.Character.Humanoid)
print("Smth not working")
end
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)
First off, where did you get the name ‘Proximity Prompt Service’ that doesn’t exist last time I checked (it may now not sure).
Second, is this a server script, if not make it one
Third here’s code that actually exists:
local ProximityPrompt = <proximity>
local function onPromptTriggered(promptObject, player)
print("Triggered")
if player == script.Parent.Parent.Parent.Parent.Owner then
print("Hopefully triggered")
seat:Sit(player.Character.Humanoid)
print("Smth not working")
end
end
ProximityPrompt.Triggered:Connect(function(player)
onPromptTriggered(prompt, player)
end)
I would not recommend using proximitypromptservice, Just use Prompt.Triggered. If you have to use it like that you will need to name prompts so as any prompt doesnt fire the function. Ensure you are doing this in a Server Script.
Alright 1 - Yes it may not be efficient but it would work
2 - I was not aware of that and had never heard of it
and 3 - The tone of this message seems a bit ‘rude’
local function onPromptTriggered(player)
print("Triggered")
if player == script.Parent.Parent.Parent.Parent.Owner then
print("Hopefully triggered")
seat:Sit(player.Character.Humanoid)
print("Smth not working")
end
end
for _, Prompt in ipairs(workspace:GetDescendants()) do
if Prompt:IsA("ProximityPrompt") then
Prompt.Triggered:Connect(onPromptTriggered)
end
end
Turns out a local variable at the very beginning was misdefined. Idk how I missed that. Fixed it and it works now. My bad, sorry. Thanks everyone for your input. Also, I didn’t realise there so many ways to do this. Understand it better now. Ty.