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
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!
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.
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?
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.