Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my proximity prompt not working twice?

I have a proximity prompt that is supposed to change a boolvalue in the player to be true/false. This is how I am doing it:

local ProximityPromptService = game:GetService("ProximityPromptService")

local function onPromptTriggered(ProximityPrompt, player)
	player.ShopOpenFolder.ShopIsOpen.Value = true
	print("hi")
end

ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

It works perfectly fine when i activate the proximity prompt, the value changes, however if i manually check the box to go back to false, once i use the proximity prompt again a second time, it does not change to true again. But the weird thing is, it does print both times, so the "player.ShopOpenFolder.ShopIsOpen.Value = true" line seems to work only once, but the printing hi works every time, sorry if i didnt explain well

1 answer

There is thing called client and server, server is the Roblox server, it holds data about the game that is shared across all players in the game, client is only your computer, it has data that only you see, when you are testing in play mode you are playing as the client, everything you change as client won't be seen on the server, since your script is most likely server script this makes sense.

What you want to do is switch to server so that changes you do are seen on the server, in Home tab you have the "Current Client" button, click it and it will swap to "Current Server', change the value back to false from there.

2 comments

0

Damn thanks ive been trying to fix this for like 2 days

0

;)

This discussion is preserved as it was. New answers, comments, and votes are closed.