I have a custom starter character, but I am trying to make it so that only certain ranks in my group spawn with the character.
I tried using customizeCharacter with Group ranks but it didn’t work… Not sure what to do.
I have a custom starter character, but I am trying to make it so that only certain ranks in my group spawn with the character.
I tried using customizeCharacter with Group ranks but it didn’t work… Not sure what to do.
What is the problem? Is it checking player’s role or giving him custom character?
You can check his role like that
game.Players.PlayerAdded:Connect(function(plr)
local Name = tostring(plr:GetRoleInGroup(11417477)) --swap with your group id
if Name ~= 'Tester' and Name ~= 'Lead developer' and Name ~= 'Developer'and Name ~= 'Owner' and Name ~= 'Admin' then
plr:Kick('YOU ARE NOT ALLOWED TO TEST WITHOUT TESTER ROLE')
end
end)
check if player have the rank for the charactr → then change its character
local function respawnPlayer(plr, modelName)
local model = replicatedstorage.Characters:FindFirstChild(modelName)
print("Model from server is", model)
local oldModel = plr.Character
local newModel = model:Clone()
local oldCFrame = oldModel:GetPrimaryPartCFrame()
plr.Character = newModel
newModel.Parent = workspace -- [1] this follows current character loading behavior
newModel:SetPrimaryPartCFrame(oldCFrame)
oldModel:Destroy()
end
local MinimumRank = 12
game.Players.PlayerAdded:Connect(Function(Player)
if Player:GetRankInGroup(GROUP_ID_HERE) < MinimumRank then
respawnPlayer(Player,ModelName)
end
end)