Help with rank door

It didn’t work :frowning: sorry.

idk whats wrong.

PlayerAdded does not fire for the local character because LocalScripts are loaded after the user joins, meaning it wont fire. You typically dont need to use PlayerAdded in LocalScripts for uses like this.

Are there errors showing up on the output? If there are, send them, and if there aren’t I’ll make my own test place on studio.

Output or script Analysis?

which one?

Heres one.
image

I see my mistake oops, try this code:

-- Localscript
local Player = game.Players.LocalPlayer
local RequiredRank = "Rank2"
local Barrier = game.Workspace:WaitForChild("Rank1_Barrier")
local leaderstats1 = Player:WaitForChild("leaderstats")
local Rank = leaderstats1.Rank

local RankNumeral = tonumber(string.sub(Rank.Value, 5))
local RequiredRankNumeral = tonumber(string.sub(RequiredRank, 5))

if RankNumeral >= RequiredRankNumeral then
Barrier:Destroy()
end
1 Like

Worked! Thanks for your help! :smiley:

1 Like

I got a question for ya. So i changed it to “CtckPvper” and now it stopped working. Any ideas why?

I don’t know what “CtckPvper” is, if you could provide more screenshots, code, or anything that is relevant to this that would be great.

Sure.
image

Ok, so it was working previously, but now it just stopped working and I can’t figure it out.

I wasn’t sure if I should message here again or create a new post… so sorry if I’m not supposed to do this.
Screenshots:

2

local Player = game.Players.LocalPlayer
local RequiredRanks = {"Rank2"} 
local Barrier = game.Workspace:WaitForChild("Rank1_Barrier")
local leaderstats1 = Player:WaitForChild("leaderstats")
local Rank = leaderstats1.Rank

if table.find(RequiredRanks,Rank.Value) then
	Barrier:Destroy()
end

So I should replace {} with “Rank2, Rank3” if i was Rank2 and above to pass through right?

No, that’s a table, you put the rank names in the table.

So “{Rank2, Rank3}” for Rank2 and above? or just “{Rank2}”?

No, it should be {“Rank2”,“Rank3”}

Didn’t work
Heres the code

local Player = game.Players.LocalPlayer
local RequiredRanks = {"Rank2"} 
local Barrier = game.Workspace:WaitForChild("Rank1_Barrier")
local leaderstats1 = Player:WaitForChild("leaderstats")
local Rank = leaderstats1.Rank

if table.find(RequiredRanks,Rank.Value) then
	Barrier:Destroy()
end

Give me a second, I’ll test it.

I found one of the issues, I set set it to leaderstats1.Rank2 instead of leaderstats1.Rank but it still doesn’t work

Just tested it in studio, it works.