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

When you click a screen... continue?

Asked by 10 years ago

I have made a textbutton that covers all across the screen and when you click it... here is the code,

script.Parent.MouseButton1Click:connect(function()
    game.StarterGui.ScreenGui.TextBox.Text = game.StarterGui.ScreenGui.TextBox.Text + 1
end)

Since TextBox is not a value I am confused on how I change the Text of textBox to add 1 when the textbutton (that covers the whole screen) is clicked. The problem is though is that it looks like this in explorer in studio.. game>StarterGui>ScreenGui>Textbutton>Script and then game>StarterGui>ScreenGui>TextBox... Is this right or should they both be in the same screen gui? They are both in opposite screen GUIs in the StarterGui. Is this right?

2 answers

Log in to vote
1
Answered by
Thetacah 712 Moderation Voter
10 years ago

You can use a Variable. An Intvalue or what not is not required.

local number = 0
local sp = script.Parent
sp.MouseButton1Click:connect(function()
number = number +1
sp.Text = ""..number
end)
0
He can use a variable, not should different methods for the same thing, however if he needs to call it from another script would a variable not be easier? Mystdar 352 — 10y
Ad
Log in to vote
0
Answered by
Mystdar 352 Moderation Voter
10 years ago

Try putting an IntValue in the Textbox then do this (Put this script in the text box too):

local Int = script.Parent.IntValue
local TextBox = script.Parent
TextBox.Text =  "" .. Int.Value
script.Parent.MouseButton1Click:connect(function()
        TextBox.Text = "" .. Int.Value +1
    end)

Try that.

0
He should use a variable... Thetacah 712 — 10y
0
I got it to work with this script but I am made a little adjustments first. raystriker6707 30 — 10y

Answer this question