Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

5 comments

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??

0

huh

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!

0

I removed an error.

0

yeah.

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."

1 comment

0

I tried this along with the answer above but nothing is working.

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

9 comments

0

The PlayerGui is in the Player so you need to get to the LocalPlayer then get to the PlayerGui and find the Gui

0

I tried this along with the comment below but nothing is working.

0

want me to help you remake teh entire script?

0

idk. Does it look right to you? Or is it completely wrong?

0

I can make it simple and easier

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.

0

Your just going into starterGui when your suppose to go in PlayerGui

0

It can be easily fixed

0

Yeah. I tried doing that.

This discussion is preserved as it was. New answers, comments, and votes are closed.