#Textbox permission

1 messages · Page 1 of 1 (latest)

dim epoch
#

I'm slightly new to luau, i cannot for the life of me figure out why my script wont work. Its not detecting when its focused on, why??? it worked fine a few minutes ago

heavy bronze
#

or server script?

#

Local scripts can detect all events and modify everting about a Ui

#

Server Scripts can only do some

#

But in almost ever case u have to Manipulate Ui using local scripts, bacause its no laggy

dim epoch
#

Ohh

#

also its a surface ui if that helps

heavy bronze
#

Imagine u click a button to open inventory and have a delay of 122 ms(it look low, and is it, but in quick actions, like open a inventory, it really matter)

dim epoch
#

will the text still display to everyone if changed to localscript?

heavy bronze
#

The Surface Gui is child of a part right?

#

but the real Ui, where is it?

dim epoch
#

yes

heavy bronze
#

We have 2 problems btw

#

One is the fact that is a script, not a local script

#

scripts cannot detect user input in most cases

#

The second problem is the fact that Guis in workspace cannot detect user input too

#

To a Ui be able to detect User Input, u have to put in PlayerGui

dim epoch
#

would it still display to every player

signal novaBOT
#

studio** You are now Level 3! **studio

heavy bronze
#

lemme show a solution

dim epoch
#

1 was a placeholder/test

heavy bronze
#

os smth

#

but

#

make it:

#

Insine Of StarterGui put your SurfaceGui

#

Dont put in the part

#

Otherwise it wont detect user input

dim epoch
#

how would it go on the part then

heavy bronze
#

When a Gui is insige StarterGui, it'll be copied onto PlayerGui when the game starter

heavy bronze
#

Click in the Adornee, and chosse the instance u would like to show the SurfaceGui

dim epoch
#

ohhh

heavy bronze
#

And after this your part will have a SurfaceGui with All user Input working

#

But dont forget to change the script to a local script

#

the local script have to be in the surface gui to work, otherwise wont

#

See some videos or smth about the diference between local and server scripts to not make any confusion while scripting

dim epoch
#

textbox*

heavy bronze
#

local script work in local, ie work in the computer of the player, to know what player it should run it have to be parented as a descentend of a Player

dim epoch
#

this isnt working is it the placement or script

heavy bronze
#

When u click Start, all the content of StarterGui will be copied to PlayerGui, PlayerGui is a child of a Player, so anywhere u put the local script(while is in SurfaceGui or smth) it work

dim epoch
#

the textbox is on the part

#

but the scripts not running

heavy bronze
dim epoch
#

Thats the entire script

heavy bronze
#

Ok

#

Thatss the problem

#

U creating a function

#

But ur not saying to the textbox what to do

#

u have to do

#

TextBox.Focused:Connect(functionhere)

#

Making this like u say to roblox: Connect this function to the action of Focused of this TextBox

dim epoch
#

Im a bit confused

heavy bronze
#

which part u get confused?

dim epoch
heavy bronze
#

function is a part of code that do smth

#

But a function is not do anything if wont be called

#
local function printHello()
  print("Hello world")
end

printHello() -- will print Hello World
#

in your code, u making this function, but not calling it anywhere

#

TextBox.Focused:Connect(functionhere)

signal novaBOT
#

studio** You are now Level 6! **studio

dim epoch
#

would it not just be called when the text is focused on?

#

im used to godot code sorry

heavy bronze
#

To roblox the function dont have nothing to do with the TextBox

dim epoch
#

shouldnt 'onFocused' be calling it wehn its focused

heavy bronze
#

U have to say, or code, to roblox to connect these to

dim epoch
#

It is though

heavy bronze
dim epoch
#

the variable score is the textbox and it tells the textbox to hcnage the texteditable bool right?

#

sorry

dim epoch
#

okay

heavy bronze
#

but the function it isnt be called

#

So dont make anything

#

cause the function isnt be calling

dim epoch
#

how would i call it when the textbox is focused on then

heavy bronze
#

connect is the act to automatically call a functin ever time that thats event happen

#

TextBox.Focused:Connect(NameOfTheFunction)

#

Thats what this line do

dim epoch
#

ohh so

#

TextBox.Focused:Connect(OnFocused)

#

?

heavy bronze
#

u have to explicty say to roblox: "Connext this function to this event on that instance"

heavy bronze
dim epoch
#

thank you ill test that

heavy bronze
#

Ok

#

You Welcome

dim epoch
#

IT works!! thanks

heavy bronze
# dim epoch IT works!! thanks

I highly recommend to You seeing videos to: How roblox connect events to function and How roblox work in client-server scripts to help u learn more!

dim epoch
#

Thanks for the tips and help

dim epoch
dim epoch
#

okayy i just taught myself remote events and scripts nvm

signal novaBOT
#

studio** You are now Level 4! **studio