#proximity prompt (simple question)
42 messages · Page 1 of 1 (latest)
local debounces = {}
prompt.Triggered:Connect(function(player: Player)
-- Here controll when u wanna stop the player
if debounces[player.UserId] then return end
debounces[player.UserId] = true
task.wait(5)
debounces[player.UserId] = nil
end)
well im trying to disable it for the player who triggered it and then wait 5 seonds until its visible to them again. this will also give them currency before it gets disabled this is what i have in the script:
script.Parent.Triggered:Connect(function(player)
player["Player Data"].Diamonds.Value = player["Player Data"].Diamonds.Value +5
script.Parent.Enabled = false
wait(5)
script.Parent.Enabled = true
end)
Yes so basically what i did but in that script
but i tested it with my sister and it was kind of annoying when she triggered it, and it gave her currency but it disapeared for me and didint give me anything
ill try
you might be using a local script
im using a script
No, prompt send the player so It would be a lot of calls to a client without reason
ik
So? It might be a serverscript
script.Parent.Triggered:Connect(function(player:Player)
local debounces = {}
player["Player Data"].Diamonds.Value = player["Player Data"].Diamonds.Value +5
if debounces[player.UserId] then return end
script.Parent.Enabled = false
debounces[player.UserId] = true
wait(5)
debounces[player.UserId] = nil
script.Parent.Enabled = true
end)
idk if i did it right
do i remove the script.Parent.Enabled = false/true?
Yes
Put the debounces table out of the function
remove it completely or just move it somewhere else?
move it at the very top?
Move It out of the function, instead It Will create a new debounces table everytime the function runs u understand?
kind of..?
Wells basically that if everytime the function runs the table IS not saved so u cant really store It
So Its like no debounce
local debounces = {}
script.Parent.Triggered:Connect(function(player:Player)
player["Player Data"].Diamonds.Value = player["Player Data"].Diamonds.Value +5
if debounces[player.UserId] then return end
script.Parent.Enabled = false
debounces[player.UserId] = true
wait(5)
debounces[player.UserId] = nil
script.Parent.Enabled = true
end)
i tested it and it was still not visible to me when another player clicked it
Yes, delete the two enabled lines
but i need it to disable for the player who triggers it then enable it 5 seconds later😀
No
only for the player who triggers it not everyplayer
It already doesnt let the player press until 5 seconds
Yes, It IS only
Thats why im using a table
So please, delete these
i tried it and it didint work lemme check the outputt
Send code if keep
local debounces = {}
script.Parent.Triggered:Connect(function(player:Player)
player["Player Data"].Diamonds.Value = player["Player Data"].Diamonds.Value +5
if debounces[player.UserId] then return end
debounces[player.UserId] = true
wait(5)
debounces[player.UserId] = nil
end)
** You are now Level 3! **
local debounces = {}
script.Parent.Triggered:Connect(function(player:Player)
if debounces[player.UserId] then return end
player["Player Data"].Diamonds.Value = player["Player Data"].Diamonds.Value +5
debounces[player.UserId] = true
wait(5)
debounces[player.UserId] = nil
end)
it kinda works it only gives me currency when i click it every 5 seconds but it didint make the prompt disapear for 5 seconds
It doesnt, but doesnt let player interact with until 5 seconds
im sorry for interupting but could one of yall help me after yall are done with this thanks
U can send a remote event to the player and disable and enable from localscript ok?