Hello! I recently have been wanting my name tag system modified, so my scripter went and modified it, however, when I finally tested it, it didn’t work. I know almost nothing about scripting and my scripter is away from home. I have tried getting the script to work but I was unable to, so I decided to come to the devforum for help. What I want the script to do is make the text change color if the user has a certain gamepass, but when I tried fixing it, the text stopped showing. I am unable to fix it, plus my scripter is unable to work on it for a while, I hope you are able to help me!
The script
local TweenService = game:GetService("TweenService")
local MarketPlaceService = game:GetService("MarketplaceService")
local Player = game:GetService('Players')
local GuiClone = script.Frame.OverheadGui:Clone()
local UIDisplay = script:WaitForChild("OverheadGui"):Clone()
local frame = UIDisplay.Frame
local BottomText = GuiClone.BottomText
local TopText = GuiClone.TopText
local gamePassId = 17893781
Player.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(char)
char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
frame.Parent = char.Head
frame.TopText.Text = Player.DisplayName
frame.BottomText.Text = ("@"..Player.Name.."")
end)
end)
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, gamePassId) then
while true do
local Color = Color3.new(math.random(), math.random(), math.random())
local ColorTween = TweenService:Create(BottomText, TopText, TweenInfo.new(3), {TextColor3 = Color})
ColorTween:Play()
wait(1)
end
end
Screenshots
Extra info
The script and everything is in ServerScriptService