I have a script where people who are in the group 35485008 and have the rank 210-255 should be instantly teleported to 9.838, 22.779, -65.825, yet its not working. help?
local groupId = 35485008
local minRank = 210
local maxRank = 255
local teleportPosition = Vector3.new(9.838, 22.779, -65.825)
local function onPlayerAdded(player)
print(player.Name .. " joined the game.")
print(player.Name .. " is in group: " .. tostring(player:IsInGroup(groupId)))
if player:IsInGroup(groupId) then
local rank = player:GetRankInGroup(groupId)
print(player.Name .. "'s rank: " .. rank)
if rank >= minRank and rank <= maxRank then
local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.CFrame = CFrame.new(teleportPosition)
print(player.Name .. " teleported!")
else
print("HumanoidRootPart not found for " .. player.Name)
end
end
end
end
Players.PlayerAdded:Connect(onPlayerAdded)```