Need help with textbox and twitter codes script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i want to make it so that when i enter the code the letters in the textbox automatically becomes upper case letters
  2. What is the issue? Include screenshots / videos if possible!
    nothing just need help with that
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i didnt find any solutions
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
    here is the local script inside the gui
local RedeemFrame = script.Parent.RedeemFrame
local CodeBox = RedeemFrame.CodeBox
local RedeemButton = RedeemFrame.RedeemButton
local ToggleButton = script.Parent.TwitterButton
local deb = false
ToggleButton.MouseButton1Click:Connect(function()
    if not deb then
        deb = true
        script.Parent.RedeemFrame:TweenPosition(UDim2.new(0.499, 0,0.471, 0),"Out","Bounce",0.75,false)
    elseif deb then
        deb = false
        script.Parent.RedeemFrame:TweenPosition(UDim2.new(0.499, 0,-0.471, 0),"Out","Bounce",0.75,false)
    end
end)

RedeemButton.MouseButton1Click:Connect(function()
    local Code = CodeBox.Text
    local Redeemed = game.ReplicatedStorage.RedeemCode:InvokeServer(Code)
    
    if Redeemed == true then
        CodeBox.Text = ""
        CodeBox.PlaceholderText = "Redeemed Code!"
        wait(1)
        CodeBox.PlaceholderText = "Twitter Code Here"
    else
        CodeBox.Text = ""
        CodeBox.PlaceholderText = "Invalid Code or Already Redeemed!"
        wait(1)
        CodeBox.PlaceholderText = "Twitter Code Here"
    end
end)
RedeemFrame.ExitButton.MouseButton1Click:Connect(function()
    if deb then
        deb = false
        script.Parent.RedeemFrame:TweenPosition(UDim2.new(0.499, 0,-0.471, 0),"Out","Bounce",0.75,false)
    end
end)

if you need the server script please ask me, thanks!

1 Like

If you want to upper case the textbox text when the redeem button is pressed or any other condition is met you can just change the line that gets the text, aka

local Code = CodeBox.Text

To

local Code = string.upper(CodeBox.Text)

Or

local Code = CodeBox.Text:upper()

Unless you are referring to another thing you want to uppercase, but generally the thing you need to do is to use string.upper

It’s really easy!

local Text = "Text"
print(string.upper(Text))
-- Prints "TEXT"

thanks you so much it worked great!

1 Like
CodeBox:GetPropertyChangedSignal("Text"):Connect(function()
    CodeBox.Text = string.upper(CodeBox.Text)
end)

Anytime! If you have anymore issues don’t be afraid to make another post!

hi it worked just now but now it says malformed string here is the updated script

local RedeemFrame = script.Parent.RedeemFrame
local CodeBox = RedeemFrame.CodeBox
local RedeemButton = RedeemFrame.RedeemButton
local ToggleButton = script.Parent.TwitterButton
local deb = false
ToggleButton.MouseButton1Click:Connect(function()
    if not deb then
        deb = true
        script.Parent.RedeemFrame:TweenPosition(UDim2.new(0.499, 0,0.471, 0),"Out","Bounce",0.75,false)
    elseif deb then
        deb = false
        script.Parent.RedeemFrame:TweenPosition(UDim2.new(0.499, 0,-0.471, 0),"Out","Bounce",0.75,false)
    end
end)

RedeemButton.MouseButton1Click:Connect(function()
    local Code = CodeBox.Text:upper()
    local Redeemed = game.ReplicatedStorage.RedeemCode:InvokeServer(Code)
    
    if Redeemed == true then
        CodeBox.Text = "
        CodeBox.PlaceholderText = "Redeemed Code!"
        wait(1)
        CodeBox.PlaceholderText = "Twitter Code Here"
    else
        CodeBox.Text = ""
        CodeBox.PlaceholderText = "Invalid Code or Already Redeemed!"
        wait(1)
        CodeBox.PlaceholderText = "Twitter Code Here"
    end
end)
RedeemFrame.ExitButton.MouseButton1Click:Connect(function()
    if deb then
        deb = false
        script.Parent.RedeemFrame:TweenPosition(UDim2.new(0.499, 0,-0.471, 0),"Out","Bounce",0.75,false)
    end
end)

Not sure if this was a typo on your end by you forgot to close string here

CodeBox.Text = "

Should e

CodeBox.Text = ""

ok now i fixed the typo but it doesnt uppercase also i forgot to mention that i want to make the text to uppercase when the player stops edditing it and i dont know how sorry for late reply

Oh you want to make it change the text on click off? You can use the FocusLost event for that

Example

CodeBox.FocusLost:Connect(function()
    CodeBox.Text = string.upper(CodeBox.Text)
end)
1 Like

also where do i put this event?

Put it somewhere in the code you have above, you coudl put it at the end if needed

Full code here!

RedeemButton.MouseButton1Click:Connect(function()
	local Code = string.upper(CodeBox.Text)
	local Redeemed = game.ReplicatedStorage.RedeemCode:InvokeServer(Code)

	if Redeemed == true then
		CodeBox.Text = ""
		CodeBox.PlaceholderText = "Redeemed Code!"
		wait(1)
		CodeBox.PlaceholderText = "Twitter Code Here"
	else
		CodeBox.Text = ""
		CodeBox.PlaceholderText = "Invalid Code or Already Redeemed!"
		wait(1)
		CodeBox.PlaceholderText = "Twitter Code Here"
	end
end)
RedeemFrame.ExitButton.MouseButton1Click:Connect(function()
	if deb then
		deb = false
		script.Parent.RedeemFrame:TweenPosition(UDim2.new(0.499, 0,-0.471, 0),"Out","Bounce",0.75,false)
	end
end)