Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

is it possible to put a clicked event on a text label?

Asked by
qwrn12 85
8 years ago

i was wundering if you could put a clicked event into a text label if its possible please tell me

0
Nope. Only for textbuttons FiredDusk 1466 — 8y
0
TextButtons are practically the same as textlabels anyway. Just convert them. Legojoker 345 — 8y
0
convert 50 textlabels qwrn12 85 — 8y

1 answer

Log in to vote
1
Answered by
Legojoker 345 Moderation Voter
8 years ago

To convert textlabels to textbuttons, all you have to do is simply make a script for it in the command bar. It involves sending each component of the text label to the button. This script will change EVERY text label in a GUI. Keep in mind that if you want some text labels to STAY text labels, you will have to put their UNIQUE name into the table (if it isn't unique, you may have a label that needs to be converted to a textbutton be overlooked because of the name).

local tab = {DontRemoveMe = true,IMSTEVE = true} -- All textlabels with names of strings in the table can be ignored; alter this as you see fit.

function goThrough(obj)
    for _,v in pairs(obj:GetChildren()) do
        if v:IsA("TextLabel") and not tab[v.Name] then
            local txtB = Instance.new("TextButton")
            txtB.Active = v.Active
            txtB.BackgroundColor3 = v.BackgroundColor3
            txtB.BackgroundTransparency = v.BackgroundTransparency
            txtB.BorderColor3 = v.BorderColor3
            txtB.BorderSizePixel = v.BorderSizePixel
            txtB.Position = v.Position
            txtB.Size = v.Size
            txtB.Rotation = v.Rotation
            txtB.Selectable = v.Selectable
            txtB.SizeConstraint = v.SizeConstraint
            txtB.Visible = v.Visible
            txtB.ZIndex = v.ZIndex
            txtB.Font = v.Font
            txtB.FontSize = v.FontSize
            txtB.Text = v.Text
            txtB.TextColor3 = v.TextColor3
            txtB.TextStrokeColor3 = v.TextStrokeColor3
            txtB.TextStrokeTransparency = v.TextStrokeTransparency
            txtB.TextTransparency = v.TextTransparency
            txtB.TextWrapped = v.TextWrapped
            txtB.TextXAlignment = v.TextXAlignment
            txtB.TextYAlignment = v.TextYAlignment
            txtB.ClipsDescendants = v.ClipsDescendants
            txtB.Draggable = v.Draggable
            txt.Name = v.Name
            v:Destroy()
            txtB.Parent = obj
        end
        if #v:GetChildren()>0 then
            goThrough(v)
        end
    end
end

goThrough(game.StarterGui.GameGUI) -- Or whatever it's named.
0
is it possible to go through this and convert names qwrn12 85 — 8y
0
Oh ok; I added a txtB.Name = v.Name to fix that. Legojoker 345 — 8y
Ad

Answer this question