I ask AI aka Assistant To Script for me [Because am noob as Coding]
“how to localscript player seat and all ProximityPrompt will off ClickablePrompt, if player jump out Seat all ProximityPrompt will on like normal” [LocalScript because i want single player]
and here is Script i dont… understand:
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local ProximityPrompts = {}
-- Function to toggle the ClickablePrompt property of all ProximityPrompts
local function toggleProximityPrompts(state)
for i, prompt in ProximityPrompts do
if prompt:IsA("ProximityPrompt") then
prompt.ClickablePrompt = state
end
end
end
-- Function to collect all ProximityPrompts in the Workspace
local function collectProximityPrompts()
for i, descendant in game.Workspace:GetDescendants() do
if descendant:IsA("ProximityPrompt") then
table.insert(ProximityPrompts, descendant)
end
end
end
-- Collect all ProximityPrompts initially
collectProximityPrompts()
-- Monitor the player's seating state
character.Humanoid.Seated:Connect(function(isSeated, seat)
if isSeated then
toggleProximityPrompts(false)
else
toggleProximityPrompts(true)
end
end)
-- Ensure ProximityPrompts are toggled correctly if the player respawns
LocalPlayer.CharacterAdded:Connect(function(newCharacter)
character = newCharacter
character:WaitForChild("Humanoid").Seated:Connect(function(isSeated, seat)
if isSeated then
toggleProximityPrompts(false)
else
toggleProximityPrompts(true)
end
end)
end)
And LocalScript i put on StarterPlayerScripts
Can Anybody Explain and How Fix it?