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

why is Textbox.Text nil when it has text?

script.Parent.Parent.Parent.Parent = Playergui script.Parent.Parent.Parent = Frame Script.Parent.Parent = textbox script.Parent = Textbutton

when i click the textbutton it prints:

(a blank print)

nil

Players.flireferret.PlayerGui.ScreenGui.Frame.Textbox.TextButton.Script:6: attempt to index a nil value Stack Begin Script 'Players.flireferret.PlayerGui.Frame.Textbox.TextButton.Script', Line 6 Stack End

local player = script.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	print ((script.Parent.Parent.Text))
	print ( tonumber(script.Parent.Parent.Text))
	player:FindFirstChild("soundid").Value =  tonumber(script.Parent.Parent.Text)
end)

2 comments

0

Are you running this from a server script? the changes the player makes in a gui isn't server sided.

0

it's a server script

1 answer

I may be wrong, but in your print on line 4 maybe try and remove the extra parentheses

1 comment

1

that doesen't affect anything

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