Proximity Prompt only works once then no longer triggers

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

Have a working proximity prompt

  1. What is the issue? Include screenshots / videos if possible!

I can use the prompt once but then it just stops. I don’t have a script that disables it, but I do have scripts relating, which I’ll post below.

script.Parent.Triggered:Connect(function(player)
	player.PlayerGui.CarSpawn.Enabled = true
end)

^ That script is inside of the prompt


--VAriables and such were declared beforehand--

local function spawncar(player, Name)
	if Name == "FordExplorer" then
		

		local MoneyManager = require(game.ServerScriptService.PurchaseHandler)
		
		MoneyManager.Vehicle(player, Name)

	elseif Name == "F150" then

		local MoneyManager = require(game.ServerScriptService.PurchaseHandler)		
		
		MoneyManager.Vehicle(player, Name)
	end
	
end
-- Call "onCreatePart()" when the client fires the remote event
remoteEvent.OnServerEvent:Connect(spawncar)

Those are the only scripts that would have a hand in interacting with the prompt

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve checked for scripting errors and such but I haven’t found any. It’s my first few times using this ao maybe it’s a property I missed. Also, I did look on the forums but most issues looked more technical than mine.

1 Like

Could you provide the script that closes your UI? Also, is the script in the proximity prompt local or server sided?

1 Like
  1. Try calling your MoneyManager module at the beginning of the entire script
  2. why are you testing what name it is then copying the code in your spawncar functions?
1 Like

This is for the UI close button

function leftClick()
	script.Parent.Parent.Parent.Enabled = false
	script.Parent.Parent.Parent.F150Frame.Visible = false
	script.Parent.Parent.Parent.FordExplorerFrame.Visible = false
end

function rightClick()
	print("Right mouse click")
end

script.Parent.MouseButton1Click:Connect(leftClick)
script.Parent.MouseButton2Click:Connect(rightClick)

The proximity promt script is server-side

  1. Thanks, Changed it
  2. I’m a little confused, but it probably looks odd because I adapted this part of the script to fit, but then I decided to learn the magic of module scripts and moved important things over there.

Ah I see, I am thinking it might be because you’re making them not visible. Could you try just disabling the ScreenGui and not turning the frames invisible?

1 Like

Is the script in the GUI a local script and the script in the proximity prompt a server script. If that’s the case try changing them to the same kind of script.

2 Likes