Hi! I want to enable a frame when a player says ":m" in the chat. I want to do this with FE. Anyone has an idea why it doesn't work?
Server Script:
local RS = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local MessageEVENT = Instance.new("RemoteEvent", RS)
MessageEVENT.Name = "MessageEvent"
local function message(player)
Player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("Message").Visible = true
print("MessageBox!")
end
MessageEVENT.OnServerEvent:Connect(message)
Local Script located in StarterCharacterScripts:
local Player = game.Players.LocalPlayer
local replicatedstorage = game:GetService("ReplicatedStorage")
local messageEvent = replicatedstorage:WaitForChild("MessageEvent")
local function sendMessage(plr)
plr.Chatted:Connect(function(message)
if message == ":m" then
messageEvent:FireServer()
end
end)
end
game.Players.PlayerAdded:Connect(sendMessage)

1 comment
Two things: things in the PlayerGui are cloned into it localled, and a PlayerAdded event doesn't fire for the localplayer in a local script anywhere on the client