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 8 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:



local create = script.Parent local frame = script.Parent.Parent local id = script.Parent.Parent.groupID.Text local plr = game.Players.LocalPlayer local ap = require(game.Workspace.TrelloAPI) create.MouseButton1Click:connect(function() if tonumber(id) and plr:GetRankInGroup(tonumber(id)) == 255 then --Line 12 wait() local group = game:GetService("GroupService"):GetGroupInfoAsync(tonumber(id.Text)) local BoardID = ap:GetBoardID("Appalachian Security Contract Application") local ListID = ap:GetListID("Applied",BoardID) local CardID = ap:AddCard("[NS] " .. group.Name, game.Players.LocalPlayer.Name, id, ListID) print("He's the owner!!!!") script.Parent.Parent.create.Visible = false wait(3) game.Players.LocalPlayer:Kick("Thank you for choosing Appalachian Private Security Company, we hope you choose us again! -APSC") else print("He's NOT the owner!!!!") script.Parent.Parent.Warn.Visible = true script.Parent.Parent.create.Visible = false wait(5) script.Parent.Parent.Warn.Visible = false script.Parent.Parent.create.Visible = true end end)

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
8 years ago
local 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:

local id = script.Parent.Parent.groupID

-- snip

create.MouseButton1Click:connect(function()
    local groupID = tonumber(id.Text) -- Use more variables and organize your code.
    if plr:GetRankInGroup(groupID) == 255 then
        -- snip
    end
end)
Ad

Answer this question