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

TextBox text does not visually change. Properties menu says it does though. Where am I going wrong?

Asked by 7 years ago
Edited by OldPalHappy 7 years ago

I think that this script should work. It is supposed to change the text in a textbox when I hover over a certain item. When I hover over the item, the text in the textbox does not visually change but it changes in the properties menu. Please help!

Script:

local antimony = game:GetService("StarterGui").AboutBox.TextBox.Text

script.Parent.ClickDetector.MouseHoverEnter:connect(function()
    antimony = "My bed."
end)

script.Parent.ClickDetector.MouseHoverLeave:connect(function()
    antimony = "..."
end)

3 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Use a LocalScript located in StarterGui and define the variables as such.

-- if the LocalScript is inside the screenGui, you could do something like this

local antimony = script.Parent.AboutBox.TextBox -- change for your situation

local clickDetector = workspace:WaitForChild("ClickDetector") -- define this correctly


-- use antimony.Text
clickDetector.MouseHoverEnter:Connect(function()
    antimony.Text = "My bed."
end)

clickDetector.MouseHoverLeave:Connect(function()
    antimony.Text = "..."
end)
0
Wow! Thanks! The only problem is that the script is supposed to be located inside the different objects. Almost like a definer. Any ideas?? ZetaReticuli 38 — 7y
0
huh OldPalHappy 1477 — 7y
0
Never mind! I've found an answer. Pretty much a script in the item gives a value into an IntValue. Depending on the value, the local script in the StarterGui picks it up and changes it accordingly. Yes! ZetaReticuli 38 — 7y
0
I removed an error. OldPalHappy 1477 — 7y
0
yeah. ZetaReticuli 38 — 7y
Ad
Log in to vote
-1
Answered by 7 years ago
Edited 7 years ago

Use PlayerGui. And you can't do this:

local antimony = ....TextBox.Text
antimony = "My bed."

As it will not change the text, but assign its value to the variable, and then assign "My bed." to the variable. Do this instead:

local antimony = ....TextBox
antimony.Text = "My bed."
0
I tried this along with the answer above but nothing is working. ZetaReticuli 38 — 7y
Log in to vote
-2
Answered by 7 years ago

First please use the LUA before writing the script and second you need to access the PlayerGui not the StarterGui. Simple mistake.

0
The PlayerGui is in the Player so you need to get to the LocalPlayer then get to the PlayerGui and find the Gui BlackOrange3343 2676 — 7y
0
I tried this along with the comment below but nothing is working. ZetaReticuli 38 — 7y
0
want me to help you remake teh entire script? BlackOrange3343 2676 — 7y
0
idk. Does it look right to you? Or is it completely wrong? ZetaReticuli 38 — 7y
View all comments (5 more)
0
I can make it simple and easier BlackOrange3343 2676 — 7y
0
The fact is that it isn't working at the moment. I'm not really bothered with compactness at the moment I just want to fix this problem. ZetaReticuli 38 — 7y
0
Your just going into starterGui when your suppose to go in PlayerGui BlackOrange3343 2676 — 7y
0
It can be easily fixed BlackOrange3343 2676 — 7y
0
Yeah. I tried doing that. ZetaReticuli 38 — 7y

Answer this question