Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script not recognizing rank inside group?

Asked by 9 years ago

So, I have a script that is meant to detect if you're the owner of the group which ID you put inside the textBox, but it keeps returning me as NOT the owner. My Username: TheHospitalDev Testing Group: http://www.roblox.com/My/Groups.aspx?gid=2732066

Script:

01local create = script.Parent
02local frame = script.Parent.Parent
03local id = script.Parent.Parent.groupID.Text
04local plr = game.Players.LocalPlayer
05 
06local ap = require(game.Workspace.TrelloAPI)
07 
08create.MouseButton1Click:connect(function()  
09    if tonumber(id) and plr:GetRankInGroup(tonumber(id)) == 255 then --Line 12
10        wait()
11        local group = game:GetService("GroupService"):GetGroupInfoAsync(tonumber(id.Text))
12        local BoardID = ap:GetBoardID("Appalachian Security Contract Application")
13        local ListID = ap:GetListID("Applied",BoardID)
14        local CardID = ap:AddCard("[NS] " .. group.Name, game.Players.LocalPlayer.Name, id, ListID)
15        print("He's the owner!!!!")
View all 28 lines...

If you need the GUI to test it, please post in comments!

1 answer

Log in to vote
3
Answered by
DevChris 235 Moderation Voter
9 years ago
1local id = script.Parent.Parent.groupID.Text

When you created this variable, you didn't store the TextButton, but rather you stored the current string that the TextLabel had. This means that the Text value won't update again when the player changes it. Therefore, you can fix the script by changing that to this:

01local id = script.Parent.Parent.groupID
02 
03-- snip
04 
05create.MouseButton1Click:connect(function()
06    local groupID = tonumber(id.Text) -- Use more variables and organize your code.
07    if plr:GetRankInGroup(groupID) == 255 then
08        -- snip
09    end
10end)
Ad

Answer this question