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

Why does my chatted event only fire my remote event once and not every time? [Solved]

I'm trying to make a trading system cuz I'm bored and I use a chatted command to open up the trade gui. Now it only works once but if I close the gui using the close button i made, it doesn't work again. Here's the code.

Client Side:

local player = game.Players.LocalPlayer
local playCommand = "?trade"
local remote = game.ReplicatedStorage:WaitForChild("openning")
player.Chatted:Connect(function(msg)
	if string.lower(msg) == playCommand then
		print("gtsgdsgh")
		remote:FireServer()
	end
	end)

server side:

game.ReplicatedStorage.openning.OnServerEvent:Connect(function(player)
			if player.PlayerGui.TradeGui.Enabled == false then
			player.PlayerGui.TradeGui.Enabled = true
			end
end)

Quick note, i tried to use player added on a server script to do it but that didn't work too and it always prints in output when i say ?trade but it only fires the remote event once.

1 comment

0

Why are you manipulating the GUI using a server script?

1 answer

Dovydas1118 asked why I manipulated the GUI using a server script so i tried to do it with a local script and now it works. Thanks :D

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