Hello! When trying to interact with a proximity prompt to spawn a car, it doesn’t work. The script is a localscript placed under the car spawner object. For some reason, it won’t even make a print statement making me think it’s something to do with the wrong proximity prompt but it isn’t.
Didn’t really help as it’s keep mentioning using Proximity Prompt service for when a prompt is triggered, but there are way to many prompts to do that and it’s a little confusing. I already done this in the past with previous games and they worked great, don’t understand why its not working.
It only enables the UI for the first time. If you open the UI and then close it and then try to open it again using the proximity prompt, it doesn’t work.
well you see why do you have the player then in there?
For the local gui script it should be
local player = game.Players.LocalPlayer -- as it's a local script you can access the player.
script.Parent.MouseButton1Up:Connect(function()
player.PlayerGui.Civ_Car_Spawn.Enabled = false
end)
As for the opener script did that work? from my advice?
LocalScripts don’t run in the Workspace. They only run in places like StarterPlayerScripts (technically PlayerScripts, where the local scripts get copied to) and PlayerGui
(If you want code to run locally from the workspace, create a Script and set it’s RunContext to Client)
Spawning a car shouldn’t be done from the client, you should do that on the server. If you change a script to be enabled from the client, it won’t replicate.
Basically, move your code to a Script and it should work fine. ProximityPrompt.Triggered works on the client and the server.
Also, unless you intentionally made the car spawner script to work with Enabled, it’s very likely this won’t work properly.
(To work with enabled the script would need to spawn a car then disable itself.)
Let me explain a little, so I have changed the car spawner to be a script and not a local script.
Another thing is that the car’s aren’t being spawned from the client. That’s a whole separate thing in the menu that’s handled by a local script that fires an event on the car to spawn and then a server script that spawns that car. I’ll try a couple different methods for disabling the UI.
use chatgpt
if anyone couldnt fix it
what about the script that when you spawn your car
send it fully here
the client script (when u fire) and the server script