i need a script of when you touch a block a message on chat appears

Ep3cSl3yer
Joined 27/12/2017
Posts 6
08:51 PM 01/11/2018
i need a script of when you touch a block a message on chat appears


[TylFT] Tylorfoot
Joined 03/06/2017
Posts 6,581
02:40 PM 02/11/2018
well there are many ways to do this. they all involve the onPlayerTouch event however.
s = define("onPlayerTouch");
s.script = '
var brick,client;
brick = arg[0];
client = arg[1];
if(isAlive(client)) {
if(brick.Name == "TOUCH") {
// whatever you want
}
}
';
rename touch to the brick that the player has to touch.
since you requested a message that appears in the chat, this script should work:

global.debounce = false;

s = define("onPlayerTouch");
s.script = '
var brick,client;
brick = arg[0];
client = arg[1];
if(isAlive(client)) {
if(brick.Name == "TOUCH") and (global.debounce == false) {
global.debounce = true;
messageAll("your message")
}
}
';

this script will only one ONCE unless the global.debounce variable is set to false in another script.

1