Hey,
i am new in Lua scripting and trying to figure out how to send a message to all online players but it doesn't work
[lua]
list = getServer:getPlayers();
for index, player in pairs(list) do
player:sendTextMessage(event.player:getPlayerName() + " died.");
end
[/lua]
![](https://www.rising-world.net/images/avatars/46/184-46274c050453444c8359a95f7efd15a90df53c1e.png)
Send message to all online players
- Levi
- Closed
A new update is now available, introducing a lot of new content!
Latest hotfix: 0.7.5.1 (2024-09-02)
Latest hotfix: 0.7.5.1 (2024-09-02)
-
-
What messages/errors do you get? What happens if you run this code?
Just 'it doesn't work' is really not lot of information
Lua doesn't support + by attaching strings together as far as i know. Try .. instead
-
Unfortunately the getPlayers() function is broken, but will be fixed with the next update
-
Try this
[lua]server = getServer();
server:brodcastTextMessage(String paramString);[/lua] -
using
getServer()
instead of
getServer
solved the problem, thanks
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!