Group Rank Door | Error

Hello!

I was in the middle of making a training centre for someone, and I tried to modify my Group Rank Door so it respawns a user if they touch it and if they are not above the RequiredRank.

Script:

local GroupId = 11501504
local RequiredRank = 11

local Player = game.Players.LocalPlayer

for i, v in pairs(game.Workspace:WaitForChild("RankDoors"):GetChildren()) do
	if v:IsA("Part") then
		if Player:GetRankInGroup(GroupId) >= RequiredRank then
			v.CanCollide = true
		else
			if Player:GetRankInGroup(GroupId) <= RequiredRank then
				game.Players:GetPlayerFromCharacter(Humanoid):LoadCharacter()
			end
		end
	end
end

Any help would be grateful! Thanks!

Try

v:IsA(“BasePart”)

That could be why it’s not working.

BasePart is basically another terminology for Part

Why is it in PlayerGui?

It’s in the StarterGUI, but everything moves to the PlayerGUI when it’s in there so it’s for the player only.

Oh okay, but it seems weird for it to be hosted in there. Could you try Workspace or StarterPlayerScripts. Let me know if both of them do not work.

The rank door was designed to be in StarterGUI. I’ve used this loads but I’ve recently configured it to respawn a player when they are below a certain rank.

1 Like

What is the point of this?

It creates a new character for the player, removing the old one, as seen here: Player | Roblox Creator Documentation.

Load character can only be called from the backend server, might as well remove that line, it doesn’t really help you, in theory that line in general doesn’t make much sense, every part inside of the “RankDoors” directory would just reload the character.

How would I get it to respawn the current character then without it creating a new one?

I don’t see the practicality of respawning a user if they are not the suitable rank it will irritate the user & doesn’t prove very beneficial.

If you wanted to you could delete a part of the character:

game.Players.LocalPlayer.Character.Head:Destroy()
1 Like

When I spawn in, it auto kills me? How do I stop that and so it only kills me when I touch the door?

for i, v in pairs(game.Workspace:WaitForChild("RankDoors"):GetChildren()) do
	if v:IsA("Part") then
		v.Touched:Connect(function()
			--Rest of script here
		end)
	end
end

Make sure to add debounce.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.