Hi, Im currently working on a game inspired by another dev, and Ive run into a problem with my script that sends strings from the local client to the server. When more than one player is in the game, for example there is 7 players, and one of them types in a textbox and clicks the send button, the string gets fired to another script to handle the string and send it of with httpservice however, my python code reacts and interacts with stuff to type in the roblox chat and it does it 7 times,I’ve checked the scripts, added debouncing systems, debugged them, and everything seemed normal. The Python code didn’t show any issues My thing is that the local script connects to the player ui to get the gui, and since every player joins the game, it might duplicate the scripts and run it in each player’s ui, possibly triggering other clients scripts and sending the message multiple times. Despite being pretty good at scripting (except for the amount of issues and poor naming I have), this issue is something I never seen before, and Ive tried many ways to solve it but had no luck
here’s some parts of the script :
local function sendmessage(chatmsg)
if sent then return end
sent = true
chathandler:FireServer(chatmsg)
Textbox.Text = "Sent message."
chathideevent:Fire('chathidekeyboard789')
playerinfo:FireServer(game.Players.LocalPlayer, "chatMSGd")
button.Visible = false
task.wait(2)
Textbox.Text = ""
button.Visible = true
sent = false
end
local function Click()
if allowuser[tostring(player.UserId)] then
local chatI = Textbox.Text
sendmessage(chatI)
elseif not debounce then
debounce = true
markser:PromptProductPurchase(player, productId)
task.wait(clickDelay)
debounce = false
end
end
- a print statement i added to check if its just the python code freaking out*
Here’s a video if you dont understand:
i will give out the full code if needed.