Group Rank Decal Transparency Issue

So I’ve got the following script which when a player equips a vest with proximity prompt they get a rank slide decal show, now the script seems to work but its not showing on the player when it’s equipped, any suggestions would help.

local Group = 5966303

local Constable_Rank = 5
local Sergeant_Rank = 10
local Senior_Sergeant_Rank = 15
local Inspector_Rank = 20
local Chief_Inspector_Rank = 25
local Superintendent_Rank = 30
local Assistant_Commissioner_Rank = 35
local Commissioner_Rank = 40

local function rankslide(plr)
	if plr:GetRankInGroup(Group) == Constable_Rank then
		script.Parent.Constable.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Sergeant_Rank then
		script.Parent.Sergeant.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Senior_Sergeant_Rank then
		script.Parent.Senior_Sergeant.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Inspector_Rank then
		script.Parent.Inspector.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Chief_Inspector_Rank then
		script.Parent.Chief_Inspector.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Superintendent_Rank then
		script.Parent.Superintendent.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Assistant_Commissioner_Rank then
		script.Parent.Assistant_Commissioner.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Commissioner_Rank then
		script.Parent.Commissioner.Transparency = 0
	end
end
1 Like

From a quick look to the script, it doesn’t have any errors.

Make sure:

  • You are using a Server Script
  • You have set up the proximity prompt on the vest and attached this script to it.
  • You have set up a handler function. ^

^ Example:

script.Parent.Triggered:Connect(function(plr)
if plr and plr:IsA("Player") then
		rankslide(plr)
end)

I’ve included the following;

script.Parent.Parent.UpperTorso.ProximityPrompt.Triggered:Connect(function(trigger)
	local plr = game.Players:GetPlayerFromCharacter(trigger.Parent)
	if plr then
		rankslide(plr)
	end
end)

However it seems as if I’m popping up with various of errors about the directory, which I’m unsure why since the directory is correct.
Any help will be highly appreciated!

What error codes are you getting?

I find that very odd though, because the path is correct:

Paste the full script here please. There are multiple issues with the way you coded it and other improvements that can be made.

local Group = 5966303

local Constable_Rank = 5
local Sergeant_Rank = 10
local Senior_Sergeant_Rank = 15
local Inspector_Rank = 20
local Chief_Inspector_Rank = 25
local Superintendent_Rank = 30
local Assistant_Commissioner_Rank = 35
local Commissioner_Rank = 40

local function rankslide(plr)
	if plr:GetRankInGroup(Group) == Constable_Rank then
		script.Parent.Constable.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Sergeant_Rank then
		script.Parent.Sergeant.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Senior_Sergeant_Rank then
		script.Parent.Senior_Sergeant.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Inspector_Rank then
		script.Parent.Inspector.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Chief_Inspector_Rank then
		script.Parent.Chief_Inspector.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Superintendent_Rank then
		script.Parent.Superintendent.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Assistant_Commissioner_Rank then
		script.Parent.Assistant_Commissioner.Transparency = 0
	elseif plr:GetRankInGroup(Group) == Commissioner_Rank then
		script.Parent.Commissioner.Transparency = 0
	end
end

script.Parent.Parent.UpperTorso.ProximityPrompt.Triggered:Connect(function(trigger)
	local plr = game.Players:GetPlayerFromCharacter(trigger.Parent)
	if plr then
		rankslide(plr)
	end
end)

From the error UpperTorso is not a valid member of Model "Workspace.Nautium.Vest", it looks like the UpperTorso is not a child of PoliceVest [The path is not correct].

Double check to see if the UpperTorso is actually a child of the PoliceVest.

It indeed is,
image


Just a quick question, isn’t this script inside the ProximityPrompt?


Instead of:

Place:


Yeah sure, it’s what I had with your original suggestion however I seem to be getting the following errors;


Can you show me your whole path please? [The Workspace Path]

Entire path for the vest;
image

then it’s placed inside a workspace>UniformTrolley (too much items to show it all)

This is the script for the ServerScript inside RankPart. (I don’t think this give errors because it’s correct)

You also have a script on the Proximity Prompt (does this give any errors?)

I recommend you use print statements to try to find which script gives you the errors.

Okay thanks, so I’ve managed to get rid of all the errors, however the rank decals are still not showing (Ive tested it with print statements which aren’t printing anything) which could suggest its got something to do with the actual rank checking?

1 Like

trigger from ProximityPrompt.Triggered is the player object of who triggered the prompt. trigger.Parent is therefore the Players service.

Try this script:


local Group = 5966303

local ranks = {
	Constable_Rank = 5,
	Sergeant_Rank = 10,
	Senior_Sergeant_Rank = 15,
	Inspector_Rank = 20,
	Chief_Inspector_Rank = 25,
	Superintendent_Rank = 30,
	Assistant_Commissioner_Rank = 35,
	Commissioner_Rank = 40
}


local function rankslide(plr)
	local rank = plr:GetRankInGroup(Group)
	for key, value in pairs(ranks) do
		if rank == value then
			script.Parent[key].Transparency = 0
		end
	end
end

script.Parent.Parent.Triggered:Connect(function(plr)
	rankslide(plr)
end)

You have to change the names of the objects so that they are the same as the variable names, so that the script will find the right thing.

2 Likes

Legend :slight_smile:
Modified the path slightly since I moved the scripts around however works flawlessly.
Much appreciated.

Yep np :slight_smile: drhgfdihhfsdeoushfdiousdfosdf