Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

"Attempt to compare string and number" Help?

Working on a gui that is cloned to your playerGui if you are at or above a certain group rank. After testing, this should work, but still isnt. Both of the values shown are number values. No values here are string. This is a serverScript that is in serverScriptService. My code:

local groupId = script.GroupId.Value
local minimumRank = script.MinimumRank.Value

game.Players.PlayerAdded:Connect(function(player)
		if player:GetRoleInGroup(groupId) <= minimumRank then
			local guiClone = script.Announce:Clone()
			guiClone.Parent = player:WaitForChild("PlayerGui")
		end
end)

Any help would be appreciated.

1 answer

✓ Accepted answer

Make sure it's GetRankInGroup, not GetRoleInGroup. Rank gives you the roleid, which is a number, role gives you the name of the role, which is a string.

local groupId = script.GroupId.Value
local minimumRank = script.MinimumRank.Value

game.Players.PlayerAdded:Connect(function(player)
        if player:GetRankInGroup(groupId) <= minimumRank then
            local guiClone = script.Announce:Clone()
            guiClone.Parent = player:WaitForChild("PlayerGui")
        end
end)

1 comment

0

Oh, thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.