someone quickly explain to me, why isnt this working.
local pantsid = "http://www.roblox.com/asset/?id=561570834"
local button = script.Parent
local player = game.Players.LocalPlayer
local char = player.Character
button.MouseButton1Click:Connect(function(plr)
if plr:IsInGroup(4924676) and plr:GetRoleInGroup(10) then -- O10
if char:findFirstChild("Shirt") then
char.Shirt.ShirtTemplate = 5026459144
else
a = Instance.new("Shirt", char)
a.Name = "Shirt"
a.ShirtTemplate = 5026459144
end
if char:findFirstChild("Pants") then
char.Pants.PantsTemplate = pantsid
else
b = Instance.new("Pants", char)
b.Name = "Pants"
b.PantsTemplate = 5026617880
end
elseif plr:IsInGroup(4924676) and plr:GetRoleInGroup(9) then -- O9
if char:findFirstChild("Shirt") then
char.Shirt.ShirtTemplate = 5026523924
else
a = Instance.new("Shirt", char)
a.Name = "Shirt"
a.ShirtTemplate = 5026523924
end
if char:findFirstChild("Pants") then
char.Pants.PantsTemplate = 5026617880
else
b = Instance.new("Pants", char)
b.Name = "Pants"
b.PantsTemplate = 5026617880
end
end
end)
--button.MouseButton1Click:Connect(function()
-- if char:findFirstChild("Shirt") then
-- char.Shirt.ShirtTemplate = shirtid
-- else
-- a = Instance.new("Shirt", char)
-- a.Name = "Shirt"
-- a.ShirtTemplate = shirtid
-- end
-- if char:findFirstChild("Pants") then
-- char.Pants.PantsTemplate = pantsid
-- else
-- b = Instance.new("Pants", char)
-- b.Name = "Pants"
-- b.PantsTemplate = pantsid
-- end
--end)```
Yes, Im using this in a GUI…
You must use GetRankInGroup in order to use the Role Number, since Role is the name of the role and will output an error of got string expected number. You also need to put the group inside the () so it would be :
:GetRankInGroup(GroupId) > or => or whatever you want to do.
2 Likes
Im having problems with “IsInGroup” not GetRoleInGroup.
You don’t need to use the :IsInGroup if he has a rank. Only check the rank since you’re adding a check for the same thing basically.
Soo I dont need IsInGroup, but how does it know that he should give that specific piece of clothing to that user?
Because you used the :GetRankInGroup wrong. You need to put in the group id insde. It would look like this.
if plr:GetRankInGroup(4924676) => 10 then
--your script function
=> is a error when I try putting that.
Oh sorry, I made a mistake. It’s >=
Try using print("player is in group")
to see if the person is in the specific group. If it prints, that means the problem is with the clothes.
GetRankInRole? What? That isn’t even a thing- I think you meant GetRankInGroup.
oh jesus christ… .-.-.-.-.-.
It still says nil tho, @TheAOTKHolder
May I see the script? (30 charssss)
Well, the problem is in the button. You see, you are using the Connect Function Name. It will display nil. Use the localplayer instead.
1 Like
local shirtid = "http://www.roblox.com/asset/?id=635864651"
local pantsid = "http://www.roblox.com/asset/?id=561570834"
local button = script.Parent
local player = game.Players.LocalPlayer
local char = player.Character
button.MouseButton1Click:Connect(function(plr)
if plr:GetRankInGroup(4924676) >= 10 then -- O10
print(plr.." is in group")
if char:findFirstChild("Shirt") then
char.Shirt.ShirtTemplate = 5026459144
else
a = Instance.new("Shirt", char)
a.Name = "Shirt"
a.ShirtTemplate = 5026459144
end
if char:findFirstChild("Pants") then
char.Pants.PantsTemplate = pantsid
else
b = Instance.new("Pants", char)
b.Name = "Pants"
b.PantsTemplate = 5026617880
end
elseif plr:GetRankInGroup(4924676) >= 9 then -- O9
if char:findFirstChild("Shirt") then
char.Shirt.ShirtTemplate = 5026523924
else
a = Instance.new("Shirt", char)
a.Name = "Shirt"
a.ShirtTemplate = 5026523924
end
if char:findFirstChild("Pants") then
char.Pants.PantsTemplate = 5026617880
else
b = Instance.new("Pants", char)
b.Name = "Pants"
b.PantsTemplate = 5026617880
end
end
end)
--button.MouseButton1Click:Connect(function()
-- if char:findFirstChild("Shirt") then
-- char.Shirt.ShirtTemplate = shirtid
-- else
-- a = Instance.new("Shirt", char)
-- a.Name = "Shirt"
-- a.ShirtTemplate = shirtid
-- end
-- if char:findFirstChild("Pants") then
-- char.Pants.PantsTemplate = pantsid
-- else
-- b = Instance.new("Pants", char)
-- b.Name = "Pants"
-- b.PantsTemplate = pantsid
-- end
--end)
So it would be player instead of plr because you have a variable that declares the localplayer which is player.
Thanks, Its working now.
.sdafpksdfĂĄ+ojksdfĂĄosdjkmf