So, I am currently working on a game, and I made a LocalScript in the StarterGui that controls a ProximityPrompt in the Workspace. Basically, what the script does is it makes the player sit down after the ProximityPrompt is triggered.
This is the LocalScript in the StarterGui:
local prox = game.Workspace:WaitForChild("Setup").Chair1.Chair1.ProximityPart.ProximityPrompt local humanoidRPart = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart") local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") local chair = game.Workspace:WaitForChild("Setup").Chair1.Chair1.Seat local cam = game.Workspace.CurrentCamera local camPart = game.Workspace:WaitForChild("Setup").ComputerCamPart local function camSnap() repeat cam.CameraType = Enum.CameraType.Scriptable wait(0.1) until cam.CameraType == Enum.CameraType.Scriptable cam.CFrame = camPart.CFrame end local UIS = game:GetService("UserInputService") local cooldown = 1 local debounce = false local sitting = false local function onSit() if debounce == false then camSnap() debounce = true chair.Disabled = false humanoidRPart.CFrame = CFrame.new(36.2, 3.46, -174.2) humanoid.Sit = true prox.Enabled = false humanoid.JumpPower = 0 wait(cooldown) debounce = true script.Parent.MainPcBackground.Enabled = true script.Enabled = false end end prox.Triggered:Connect(onSit)
After the player sits down, a Gui Pops-Up, where there is an Exit Button that the players can click to make the Gui disappear and re-enable the ProximityPrompt.
local cam = game.Workspace.CurrentCamera local player = game.Players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local seat = game.Workspace:WaitForChild("Setup"):WaitForChild("Chair1"):WaitForChild("Chair1"):WaitForChild("Seat") local prox = seat.Parent:WaitForChild("ProximityPart"):WaitForChild("ProximityPrompt") local ExitButton = script.Parent ExitButton.MouseButton1Click:Connect(function() ExitButton.Visible = false script.Parent.Parent.Parent.Enabled = false wait(1) cam.CameraType = Enum.CameraType.Custom cam.CFrame = character:WaitForChild("Head").CFrame humanoid.JumpPower = 50 humanoid.Jump = true seat.Disabled = true prox.Enabled = true wait(1) script.Parent.Visible = true end)
These two scripts work just fine, and there are No Errors. However, my problem is that it doesn't do anything when the ProximityPrompt Re-Enables, after the player Triggers it a second time. Is there a way to make it so that when you Exit the GUI, the ProximityPrompt will work again?
Nevermind Everyone. I just solved the issue. I used a different method to get the player to sit down.