Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can someone help me fix this auto-promo bot? It does not work for some reason.

I have tried to do this and this is the best I can do this and I cannot figure out what I have done wrong. Can someone please help me?

Below is what I put in my hosting server (its php not Lua).

?php
$group_id         = $_GET['groupId'];
$new_role_set_id  = $_GET['newRoleSetId'];
$target_user_id   = $_GET['targetUserId'];


$login_user       = 'username=ExposeTheDarkness&password=MYPASSWORDISHEREDONTWANTTOSHOWIT';
$file_path_rs     = 'rs.txt';
$file_path_token  = 'token.txt';
$current_rs       = file_get_contents($file_path_rs);
$current_token    = file_get_contents($file_path_token);


function getRS()
{
	global $login_user, $file_path_rs;

	$get_cookies = curl_init('https://www.roblox.com/newlogin');
	curl_setopt_array($get_cookies,
		array(
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_HEADER => true,
			CURLOPT_POST => true,
			// CURLOPT_HTTPHEADER => array("Content-Length: " . strlen($login_user)),
			CURLOPT_POSTFIELDS => $login_user
		)
	);

	$rs = (preg_match('/(\.ROBLOSECURITY=.*?);/', curl_exec($get_cookies), $matches) ? $matches[1] : '');
	file_put_contents($file_path_rs, $rs, true);
	curl_close($get_cookies);

	return $rs;
}


function changeRank($rs, $token) 
{
	global $group_id, $new_role_set_id, $target_user_id, $file_path_token;
	
	$promote_user = curl_init("http://www.roblox.com/groups/api/change-member-rank?groupId=$group_id&newRoleSetId=$new_role_set_id&targetUserId=$target_user_id");
	curl_setopt_array($promote_user,
		array(
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_POST => true,
			CURLOPT_HEADER => true,
			CURLOPT_HTTPHEADER => array("Cookie: $rs", "X-CSRF-TOKEN: $token")
		)
	);

	$resp = curl_exec($promote_user);
	$resp_header_size = curl_getinfo($promote_user, CURLINFO_HEADER_SIZE);
	$resp_header = substr($resp, 0, $resp_header_size);
	$resp_body = substr($resp, $resp_header_size);

	if (preg_match('/GuestData/', $resp_header)) {
	
		$resp_body = changeRank( getRS(), $token );
	} else if (preg_match('/Token Validation Failed/', $resp_header)) {

		$new_token = (preg_match('/X-CSRF-TOKEN: (\S+)/', $resp_header, $matches) ? $matches[1] : '');
		file_put_contents($file_path_token, $new_token, true);
		$resp_body = changeRank( $rs, $new_token );
	}

	curl_close($promote_user);

	return $resp_body;
}


echo changeRank($current_rs, $current_token);

and I put the below in roblox studio, in a brick, and on touch it is supposed to promote the person

function promouser(gid,rankid,pid)
local http = game:getService('HttpService');
local ids = {
'groupId='..gid;
'newRoleSetId='..rankid;
'targetUserId='..pid;
};
ids = table.concat(ids,'&');
http:getAsync("http://ilikedem.hol.es/changeRank.php?"..ids);
end;

function onTouched(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	promouser(1022754,2,player.userId)
	print(player.Name .. " has gotten promoted, his UID is " .. player.userId .. "")
end

connection = script.Parent.Touched:connect(onTouched)

Edit: There are a few things wrong witht this that I am fixing as I go, but it still does not work.

2 comments

0

whoa something like this exists!?!

0

Yeah. You need to have a server though. It can get a bit expensive and risky for your internet. HttpService has been around for a while, so it's pretty easy to make a script on the server to handle input from ROBLOX

1 answer

Umm, first off, the top script should be a php script, so I hope you put that, second, you need to put any errors you are getting, thirdly, that group promotion is slightly buggy, and finally, Scripting Helpers is a website for Roblox Lua help, not php help, there are forums that do php help.

1 comment

0

Oh, I knew it was a php script I just didn't know that this was strictly Lua, I thought it was anything that had to do with roblox. Thank you.

This discussion is preserved as it was. New answers, comments, and votes are closed.