I’m trying to have a proximity prompt that allows me to enter a car. It works, however after using the prompt once, it stops showing up.
Video Example:
I have searched all over the forum but nobody has had the same issue as me.
Vehicle seat code:
local player
local char
local Scripts = script.Parent.Parent.Scripts
local ContextActionService = game:GetService("ContextActionService")
local EXIT_ACTION_NAME = "VehicleChassisExitVehicle"
script.Parent.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
char = workspace:WaitForChild(player.Name)
char:WaitForChild("Humanoid").HeadScale.Value = 0.1
char:WaitForChild("Humanoid").BodyDepthScale.Value = 0.1
char:WaitForChild("Humanoid").BodyWidthScale.Value = 0.1
char:WaitForChild("Humanoid").BodyHeightScale.Value = 0.1
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "_ClientControls"
screenGui.ResetOnSpawn = true
screenGui.Parent = playerGui
local scriptsReference = Instance.new("ObjectValue")
scriptsReference.Name = "ScriptsReference"
scriptsReference.Value = Scripts
scriptsReference.Parent = playerGui
local clone2 = script.Parent.Parent.Scripts.LocalVehicleGui:Clone()
clone2.Parent = player.PlayerGui
local clone = script.Parent.Parent.Scripts.Driver:Clone()
clone.Disabled = false
clone.Parent = player.PlayerGui
player.CameraMaxZoomDistance = 35
player.CameraMinZoomDistance = 0.5
clone.CarValue.Value = script.Parent.Parent
script.Parent.EnterDrive.ProximityPrompt.MaxActivationDistance = 0
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
char:WaitForChild("Humanoid").HeadScale.Value = 1
char:WaitForChild("Humanoid").BodyDepthScale.Value = 1
char:WaitForChild("Humanoid").BodyWidthScale.Value = 1
char:WaitForChild("Humanoid").BodyHeightScale.Value = 1
if player.PlayerGui:FindFirstChild("Driver") then
player.PlayerGui.Driver:Destroy()
end
if player.PlayerGui:FindFirstChild("LocalVehicleGui") then
player.PlayerGui.LocalVehicleGui:Destroy()
end
player.CameraMaxZoomDistance = 400
player.CameraMinZoomDistance = 0.5
game.ReplicatedStorage.unbindCarKeys:FireClient(player)
wait(0.001)
char:SetPrimaryPartCFrame(script.Part.CFrame)
script.Parent.EnterDrive.ProximityPrompt.MaxActivationDistance = 10
end
end)