game.Players.PlayerAdded:Connect(function(player)
player.chatted:Connect(function(NewMsg)
print(NewMsg)
for _, V in pairs(game.Players:GetChildren()) do
if V.SettingsFolder.AllChatVisible.Value == true then
Event:FireClient(V.Name, player.DisplayName.."(Chat)", NewMsg)
end
end
end)
end)
Not sure what the issue is here, at like 20 in my script (the line that fires an event) is giving me an error saying “Unable to cast value to object”
Try this, you were using “player.chatted” It’s supposed to be “player.Chatted”
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(NewMsg)
print(NewMsg)
for _, V in pairs(game.Players:GetPlayers()) do
if V.SettingsFolder.AllChatVisible.Value == true then
Event:FireClient(V.Name, player.DisplayName.."(Chat)", NewMsg)
end
end
end)
end)
game.Players.PlayerAdded:Connect(function(player)
player.chatted:Connect(function(NewMsg)
print(NewMsg)
for _, V in pairs(game.Players:GetChildren()) do
if V.SettingsFolder.AllChatVisible.Value == true then
Event:FireClient(player, V.Name, player.DisplayName.."(Chat)", NewMsg)
end
end
end)
end)
you have to pass a player object first, not just a player name