script.Parent.DialogChoiceSelected:connect(function(choice, player) if player.GetRankInGroup (2672272) >= 2 then game.ServerStorage:findFirstChild(choice.Name) game.ServerStorage:findFirstChild(choice.Name):clone().Parent = workspace end end)
18:35:22.454 - GetRankInGroup is not a valid member of DialogChoice
There are a few minor errors here:
script.Parent.DialogChoiceSelected:connect(function(player, choice) if player:GetRankInGroup(2672272) >= 2 then if game.ServerStorage:FindFirstChild(choice.Name) then game.ServerStorage[choice.Name]:Clone().Parent = workspace end end end)
In the first line, you simply had the parameters backwards.
In the second line, GetRankInGroup
is called as a method, not a function. This is true for I think every ROBLOX-provided function.
The third line uses the older (now technically deprecated) findFirstChild
. In future code, use FindFirstChild
instead. Same with clone
vs. Clone
.
Also in the third line, you aren't actually checking that it exists. If the FindFirstChild
fails to find anything, it'll try to Clone
that nothing anyway, producing an error. Needs an if
statement.
And, finally, on the fourth line, you don't need to repeat the FindFirstChild
, since it's known to already exist. Simply use brackets to directly access it.