Roblox Forum banner

rainbow chat tag help

315 Views 8 Replies 2 Participants Last post by  binary
how can i modify this so that only the game owner can win the rainbow tag

yt script video

Code:
local replicatedStorage = game:GetService("ReplicatedStorage")



local Players = game:GetService("Players")



local RS = game:GetService("RunService")







local overheadGui = replicatedStorage:WaitForChild("overheadGui")







Players.PlayerAdded:Connect(function(player)



    player.CharacterAdded:Connect(function(character)



        local guiClone = overheadGui:Clone()



        character:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None



        guiClone.Parent = character:WaitForChild("Head")



        local playerName = guiClone:WaitForChild("playerName")



        playerName.Text = player.Name



        local grad = Instance.new("UIGradient")



        grad.Parent = playerName







        local counter = 0



        local w = math.pi / 6



        local CS = {}



        local num = 15



        local frames = 0



        local count = 0



        local cskCache = {}







        while true do



            for i = 0, num do



                local c = Color3.fromRGB(127 * math.sin(w*i + counter) + 128, 127 * math.sin(w*i + 2 * math.pi/3 + counter) + 128, 127*math.sin(w*i + 4*math.pi/3 + counter)+ 128)



                table.insert(CS, i+1, ColorSequenceKeypoint.new(i/num, c))



            end



            local newCS = ColorSequence.new(CS)



            if #cskCache > 0 then



                if newCS == cskCache[1] then



                    CS = {}



                    break



                end



            end



            table.insert(cskCache, newCS)



            CS = {}



            counter = counter + math.pi/40



            if (counter >= math.pi * 2) then counter = 0 end



        end



        local finalCacheCt = #cskCache



        local rotation = 1



        RS.Heartbeat:Connect(function()



            if math.fmod(frames, 2) == 0 then



                grad.Color = cskCache[rotation]



                if rotation >= #cskCache then rotation = 0 end



                rotation = rotation + 1



            end



            if frames >= 1000 then frames = 0 end



            frames = frames + 1



        end)



    end)



end)
See less See more
1 - 9 of 9 Posts
Do a check to see if player's UserId is the owner's Id.

Code:
local replicatedStorage = game:GetService("ReplicatedStorage")

local Players = game:GetService("Players")

local RS = game:GetService("RunService")

local overheadGui = replicatedStorage:WaitForChild("overheadGui")

local ownerId = 604313811 -- playerId, change this to your owner's playerId

local function giveRainbowOverhead(player,character)
    local guiClone = overheadGui:Clone()

        character:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

        guiClone.Parent = character:WaitForChild("Head")

        local playerName = guiClone:WaitForChild("playerName")

        playerName.Text = player.Name

        local grad = Instance.new("UIGradient")

        grad.Parent = playerName

        local counter = 0

        local w = math.pi / 6

        local CS = {}

        local num = 15

        local frames = 0

        local count = 0

        local cskCache = {}

        while true do


            for i = 0, num do

                local c = Color3.fromRGB(127 * math.sin(w*i + counter) + 128, 127 * math.sin(w*i + 2 * math.pi/3 + counter) + 128, 127*math.sin(w*i + 4*math.pi/3 + counter)+ 128)

                table.insert(CS, i+1, ColorSequenceKeypoint.new(i/num, c))

            end

            local newCS = ColorSequence.new(CS)

            if #cskCache > 0 then

                if newCS == cskCache[1] then

                    CS = {}

                    break

                end

            end

            table.insert(cskCache, newCS)

            CS = {}

            counter = counter + math.pi/40

            if (counter >= math.pi * 2) then counter = 0 end

        end

        local finalCacheCt = #cskCache

        local rotation = 1

        RS.Heartbeat:Connect(function()

            if math.fmod(frames, 2) == 0 then

                grad.Color = cskCache[rotation]

                if rotation >= #cskCache then rotation = 0 end

                rotation = rotation + 1

            end

            if frames >= 1000 then frames = 0 end

            frames = frames + 1

        end)
end


Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)
        task.wait(2)
        if player.UserId == ownerId then
            giveRainbowOverhead(player,character)
        else
            -- do nothing
        end
    end)

end)
If you don't know your userID, look at the url of your profile page in Roblox.
Rectangle Font Parallel Electric blue Logo
See less See more
Do a check to see if player's UserId is the owner's Id.

Code:
local replicatedStorage = game:GetService("ReplicatedStorage")

local Players = game:GetService("Players")

local RS = game:GetService("RunService")

local overheadGui = replicatedStorage:WaitForChild("overheadGui")

local ownerId = 604313811 -- playerId, change this to your owner's playerId

local function giveRainbowOverhead(player,character)
    local guiClone = overheadGui:Clone()

        character:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

        guiClone.Parent = character:WaitForChild("Head")

        local playerName = guiClone:WaitForChild("playerName")

        playerName.Text = player.Name

        local grad = Instance.new("UIGradient")

        grad.Parent = playerName

        local counter = 0

        local w = math.pi / 6

        local CS = {}

        local num = 15

        local frames = 0

        local count = 0

        local cskCache = {}

        while true do


            for i = 0, num do

                local c = Color3.fromRGB(127 * math.sin(w*i + counter) + 128, 127 * math.sin(w*i + 2 * math.pi/3 + counter) + 128, 127*math.sin(w*i + 4*math.pi/3 + counter)+ 128)

                table.insert(CS, i+1, ColorSequenceKeypoint.new(i/num, c))

            end

            local newCS = ColorSequence.new(CS)

            if #cskCache > 0 then

                if newCS == cskCache[1] then

                    CS = {}

                    break

                end

            end

            table.insert(cskCache, newCS)

            CS = {}

            counter = counter + math.pi/40

            if (counter >= math.pi * 2) then counter = 0 end

        end

        local finalCacheCt = #cskCache

        local rotation = 1

        RS.Heartbeat:Connect(function()

            if math.fmod(frames, 2) == 0 then

                grad.Color = cskCache[rotation]

                if rotation >= #cskCache then rotation = 0 end

                rotation = rotation + 1

            end

            if frames >= 1000 then frames = 0 end

            frames = frames + 1

        end)
end


Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)
        task.wait(2)
        if player.UserId == ownerId then
            giveRainbowOverhead(player,character)
        else
            -- do nothing
        end
    end)

end)
If you don't know your userID, look at the url of your profile page in Roblox.
View attachment 70857
it worked. thx bro.
are you a dev? xd
how do you learn lua?
  • Like
Reactions: 1
it worked. thx bro.
are you a dev? xd
how do you learn lua?
Yes, I'm a developer. Roblox Luau is as easy as straightforward reading for me. For example, If ThisThing equals ThatThing then do ThisAction else DoThisInstead TheEnd. I am just into computer languages since middle school. When I build my first game in Roblox Studio, I looked up scripts to do actions that I wanted. Many codes are repetitive and it helps me remember them easily.
Yes, I'm a developer. Roblox Luau is as easy as straightforward reading for me. For example, If ThisThing equals ThatThing then do ThisAction else DoThisInstead TheEnd. I am just into computer languages since middle school. When I build my first game in Roblox Studio, I looked up scripts to do actions that I wanted. Many codes are repetitive and it helps me remember them easily.
for me it is difficult because I know few words in English. I'm from Brazil
for me it is difficult because I know few words in English. I'm from Brazil
html is easy for me because I can memorize the codes. other programming languages are more difficult
html is easy for me because I can memorize the codes. other programming languages are more difficult
Same concept. You open a code and you close that code.
[Open] ... [Close], [Start] ... [End], <html> <body> ... </body> </html>, function variable() ... end.
I used to have my own personal website back when Geocities and MySpace were still popular and I did a lot of experiments with HTML.
  • Like
Reactions: 1
Same concept. You open a code and you close that code.
[Open] ... [Close], [Start] ... [End], <html> <body> ... </body> </html>, function variable() ... end.
I used to have my own personal website back when Geocities and MySpace were still popular and I did a lot of experiments with HTML.
html is cool. but to earn money as a programmer it would be good for me to learn C++, C# and/or other programming languages.
  • Like
Reactions: 1
1 - 9 of 9 Posts
Top