I’m trying to make the player’s name (UpperText) flash rainbow colors when they have a certain game pass.
I have no idea what is wrong with the script, if anyone has any suggestions or fixes, please let me know.
Script:
local gamepassId = 8227438
local frame = game.ReplicatedStorage.NameTag.UpperText
game.Players.PlayerAdded:Connect(function(Player)
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, gamepassId) then
while true do
for hue = 0, 255, 4 do
frame.TextColor3 = Color3.fromHSV(hue/256, 1, 1)
frame.TextColor3 = Color3.fromHSV(hue/256, .5, .8)
wait()
end
end
end
end)
If I am right, You actually need to reference the Overhead GUI inside of the player character, you are currently referencing to the Replicated Storage’s one, which I believe is not used directly.
When you clone the Billboardgui, that GUI goes to player head… but when your using local frame = game.ReplicatedStorage.NameTag.UpperText that would only change that GUI not the clones.
Script
local gamepassId = 8227438
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(char)
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, gamepassId) then
local FindGui = char:WaitForChild(“Head”):WaitForChild(“NameTag”)
local Frame = FindGui.UpperText
while true do
for hue = 0, 255, 4 do
frame.TextColor3 = Color3.fromHSV(hue/256, 1, 1)
frame.TextColor3 = Color3.fromHSV(hue/256, .5, .8)
wait()
end
end
end
end)
end)
Ok, seems like you aren’t understanding. So I believe what you are doing is, when Player’s Character is spawned, you add a overhead text GUI to their character head or something and I believe that is where the Overhead GUI is cloned from ReplicatedStorage into the character, so what I meant is you are cloning a new instance of that GUI and putting it inside character and that’s the one you need to run your rainbow Color loop on, but what you are doing currently:
What is happening now: You are basically running a rainbow color loop on the GUI instance in ReplicatedStorage, which will be used for players that join next. But not the player you want to do the rainbow color loop for.
So If you could tell us where the GUI is cloned into the character, then we could figure it out pretty easily.
You referenced the original name tag, not the one you clone to the players’ head.
You did not wait for the character to load.
Here is the updated script:
local gamepassId = 8227438
local MarketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local clone = game.ReplicatedStorage.NameTag:Clone()
clone.Parent = Character.Head
local UpperText = clone.UpperText
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, gamepassId) then
while true do
for hue = 0, 255, 4 do
UpperText.TextColor3 = Color3.fromHSV(hue/256, 1, 1)
UpperText.TextColor3 = Color3.fromHSV(hue/256, .5, .8)
wait()
end
end
end
end)
end)