I haven’t experienced this issue before, and for some reason it just popped up after I’ve been working in studio for a bit.
All of my commands that use the Player.Chatted() event that have an if statement to see if the message is the actual command have broken. I have tried debugging the issue by putting print statements after that event, but nothing is appearing in output from those print statements.
This was just some code that I used to debug it. I’m pretty sure I’m just making some simple mistake that I overlooked, but if someone could help me fix this it would be appreciated.
if msg == "hi" then
Is that the whole code you’re working with? This code should be working so I’m pinning it down to outside interference as to why this isn’t functioning the way you want it to. For example, you might have a yielding call before this which prevents the function from listening to PlayerAdded in time.
To avoid these kinds of scenarios for good, I’ve opted myself to create my functions separately and do all the connections at the end where necessary. For PlayerAdded, I connect it first then run it for all players that may be existing in the server before the function has a chance to get called on them.
local Players = game:GetService("Players")
local function playerAdded(player)
for _, player in ipairs(Players:GetPlayers()) do