Hi. I am trying to make a brick that automatically ranks people when they touch it in a group. I am trying to get the players UserId but for that I need LocalPlayer or such to get the userId. I need to use a Server script though for the HTTP or whatever. Man, this auto-ranking system got me all screwed up.
This is my script. I've tried it in both Server and Local scripts.
I honestly have been trying to get this to work for a week now and I don't even know if that's the right URL.
In console it says 'Attempt to index field 'LocalPlayer' (A nil value)
function promouser(gid,rankid,pid)
local http = game:getService('HttpService');
local ids = {
'groupId='..gid;
'newRoleSetId='..rankid;
'targetUserId='..pid;
};
ids = table.concat(ids,'&');
http:getAsync("https://nameless-bayou-12782.herokuapp.com/"..ids);
end;
game.Workspace.AutoPromote.Touched:connect (function(hit)
promouser(3438171, 23700925, game.Players:GetPlayerFromCharacter(hit.Parent).UserId)
print("Promoted to Moderator in Training")
end)

1 comment
You don't need LocalPlayer because this is not running on the client.