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.
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