I’m attempting to create an autofill system for usernames, and am having a bit of trouble. I have created the function that actually gets the player, and calculates all of the characters left to fill in the box, which works fine. However, I’m stuck as to how I could get it to actually fill the text in. This is what I’ve tried so far:
script.Parent.Username:GetPropertyChangedSignal("Text"):Connect(function()
if string.len(script.Parent.Username.Text) ~= 0 then
local player = FUNCTIONS:getPlayer()
if player then
local UsernameLeft = string.sub(player.Name, string.len(script.Parent.Username.Text)+1) -- gets the part of the username left
for i = 0, #script.Parent.Username.Text do
script.Parent.Username.Fill.Text = " "..UsernameLeft
end
end
end
end)
I’m unsure as to how I could get it to actually add a space each time instead of keeping the one.