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

Why wont the script make a stringvalue???

Hi, So there is a folder on the workspace called "votes" and each time someone wants to vote for someone, they type who in the Usr textbox and why in the Why Textbox and when someone clicks on the button a string value gets created with the Usr text and the value is the Why text but it does not wanna work. can someone help me?

usr = script.Parent.Parent.Usr.Text
reason = script.Parent.Parent.Why.Text



function add()
a = Instance.new("StringValue")
a.Name = usr
a.Value = reason
a.Parent = game.Workspace.Votes
end

script.Parent.MouseButton1Click:Connect(add)

1 answer

✓ Accepted answer

You're tying the wrong Events, the TextBox counteracts with the MouseButton1Click. Try indexing the TextBox through a Variable, then running the statement with the

variablename.FocusLost:Conenct(function(add)

4 comments

0

Using FocusLost will take the information from the TextBox after it's someone presses enter, giving you the final information left from the last events of what the player typed, giving you the full information they "asked"

0

Apologies, I sped wrote that explanation, following the answer, if you'd like I could explain it more thoroughly?

0

Oops, don't listen to what I said for MouseButton1Down, it's actually a GuiProperty. I wrote that too quick, although the fix is a hundred percent reliable!

0

Its ok.

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