So, I took my old rainbow nametag script and tried to make it to where only SHR+ get the effect, however it is erroring! Can anyone tell me what’s wrong?
local N = script.Parent["Player Name"]
local Player = game.Players.LocalPlayer
local minimumRank = 248
if Player:GetRankInGroup(6741421) >= minimumRank then
while true do
for i=0,1,0.01 do
N.TextColor3 = Color3.fromHSV(i,1,1)
wait(0.09)
end
end
end
Error:
22:06:29.658 Workspace.NotAid_n.Head.Tag.RB:6: attempt to index nil with 'GetRankInGroup' - Server - RB:6
22:06:29.658 Stack Begin - Studio
22:06:29.658 Script 'Workspace.NotAid_n.Head.Tag.RB', Line 6 - Studio - RB:6
22:06:29.658 Stack End - Studio
22:06:31.648 Player is at or above minimum rank - Client - GroupDoorScript:7
Your script is a server script and you’re trying to use localplayer in it. We can’t do that because the localplayer doesn’t exist in server scripts since it’s a script running on the server.
Instead, since the script is inside of the character, we can get the player from the character:
local character = script.Parent.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local N = script.Parent["Player Name"]
local minimumRank = 248
if player:GetRankInGroup(6741421) >= minimumRank then
while true do
for i = 0, 1, 0.01 do
N.TextColor3 = Color3.fromHSV(i,1,1)
wait(0.09)
end
end
end
still says
ServerScriptService.NameTagScript.Tag.RB:7: attempt to index nil with ‘GetRankInGroup’ - Server - RB:7
11:58:31.172 Stack Begin - Studio
11:58:31.172 Script ‘ServerScriptService.NameTagScript.Tag.RB’, Line 7 - Studio - RB:7
Script RN:
local character = script.Parent.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local N = script.Parent["Player Name"]
local minimumRank = 248
if player:GetRankInGroup(6741421) >= minimumRank then
while true do
for i = 0, 1, 0.01 do
N.TextColor3 = Color3.fromHSV(i,1,1)
wait(0.09)
end
end
end