Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my proximity prompt not working twice?

Asked by
338218 0
2 years ago

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

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
2 years ago
Edited 2 years ago

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.

0
Damn thanks ive been trying to fix this for like 2 days 338218 0 — 2y
0
;) imKirda 4491 — 2y
Ad

Answer this question