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

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

Asked by
atmxe 17
3 years ago
Edited by JesseSong 3 years ago

This question has been solved by the original poster.

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.

0
Why are you manipulating the GUI using a server script? Dovydas1118 1495 — 3y

1 answer

Log in to vote
1
Answered by
atmxe 17
3 years ago

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

Ad

Answer this question