How can I make a script or a localscript were if a specific player isnt a group rank then the workspace gets deleted?

local Player = game:GetService("Players")
local Plr = Player:GetPlayerByUserId(131504927)

if Plr:GetRankInGroup(32857374) >= 254 then
	return
else
	workspace:ClearAllChildren()
end

Local script
I tried to do it myself, of course it didn’t work.
I wanna make a script incase I don’t get paid and just exiled.

A script were if I am not a rank in the group then the workspace children gets cleared/destroyed

Here is the correct code. I think this will work

local Players = game:GetService("Players") -- Players

local GroupId = 123 -- Change this too
local GroupRank = 1 -- Change this

Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(GroupId) >= GroupRank then -- Seeing if the player is inthe group
        return -- Stop the script
    else -- Else
       workspace:ClearAllChildren() -- Destroy everything
    end
end)

Hi, is this what you’re looking for?