#textlabel script not workiinnggg

36 messages · Page 1 of 1 (latest)

molten shoal
#

trying to make it so that when player joins the game, they assigned a clan name with the rarity and percentages on what clan they will join, but it wont update the text field on the textlabel

#

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local ClanTextLabel = PlayerGui:WaitForChild("ClanTextLabel")

game.Players.PlayerAdded:Connect(function(player)
    
    local randomNum = math.random(1, 100)
    local clanAssigned = false

    -- Check the random number against the rarity percentages
    for _, clan in pairs(clanInfo) do
        if randomNum <= clan.rarity and not clanAssigned then
            
            clanAssigned = true
            
                ClanTextLabel.Text = "Clan: " .. clan.name
            print("Assigned player to " .. clan.name .. " clan with a rarity of " .. clan.rarity .. "%")
            break
        end
    end
end)```
rapid tendon
#

any errors in console?

molten shoal
#

no

rapid tendon
#

what is claninfo?

molten shoal
#

local clanInfo = {
    {name = "Imamura", rarity = commonRarity},
    {name = "Lemon", rarity = uncommonRarity},
    {name = "Kuon", rarity = rareRarity},
    {name = "Naruhaya", rarity = veryRareRarity},
    {name = "Kunigami", rarity = epicRarity},
    {name = "Isagi", rarity = legendaryRarity}
}```
rapid tendon
#

instead of vars as rarity why not try just numbers?

molten shoal
#

idk 🤷‍♂️

#

i jsut wanna fix the issue of it not showing

rapid tendon
#

alright

molten shoal
#

on the textlabel itself

rapid tendon
#

what are the properties of the tex label

molten shoal
#

didnt do anything to it

#

i put text as nothing

rapid tendon
#

put random set of strings as the text in propertys

#

just so it works

#

if nothing appears try scaling the text size down

molten shoal
#

nope

rapid tendon
#

why are you doing a whole process to define the textlabel?

#

just do script.parent as the textlabel

molten shoal
#

k changed that

rapid tendon
#

well?

molten shoal
#

nope

rapid tendon
#

oh i see the problem

#

why are you putting a joined player event in a local script

#

the script is gonna run when the player joins anyway

molten shoal
#

oh alrigh

#

oh shit it worked

#

thanks