this works for 1 time when i trigger proximity prompt but if i make frame invisible
and trigger proximityprompt again frame it didnt works
script is here:
local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function(Player)
if Player.Cars.MustangBought.Value == true then
seat:Sit(Player.Character.Humanoid)
else
Player.PlayerGui.BuyGui.BuyFrame.Visible = true ---- makes visible if value is false
end
end)
i dont know why it didnt work can you help me please
Is this in a server script by any chance? It likely is judging by your issue. reason is that it works the first time is that in the server the frame is invisible. You are likely making the frame invisible from the client and since the server can’t see client changes, when you run it again the server still sees the frame as visible and thus nothing happens.
You will likely need to change the code around so that making the BuyFrame visible is done from the client and not from the server. I think you can turn the script into a localscript and put ti somewhere that it can run in (StarterPlayerScripts would be your best choice most likely) and add an if statement in the Triggered event to make sure the code only happens for that player only.
if Player ~= game:GetService("Players").LocalPlayer then
return
end
Your script likely works (it just needs to be a local script), because when the first player activates the ProximityPrompt the frames visibility is set to true, which is then reflected server-wide to all players, so simply moving this to a local script will suffice.