Hey, another question for today.
I am trying to get the text of a textbox.
As test, I try to print the text that was put in.
But always, nothing gets printed, just an empty space.
I dont know how to fix that, since I dont find any other Option that gives the input of the TextBox.
Thats the script.
local player = script.Parent.Parent.PlayerName.Text local coins = script.Parent.Parent.CoinsAmount.Text local CoinChange = game.ReplicatedStorage.CoinChange script.Parent.MouseButton1Click:Connect(function() workspace.CoinChange.Coins.Value = coins workspace.CoinChange.Player.Value = player print(workspace.CoinChange.Coins.Value) print(coins) CoinChange:FireServer(coins, player) end)
Hmm.. where is this script located, if it's in a button im assuming u want it to print the text value? Also make sure it's a local script.
script.Parent.MouseButton1Click:connect(function() print(script.Parent.Parent.Coins.Text) -- points to a textlabel to grab the text data from and print it when u click end)
This is what I usually do, and your script may work, it's just not a local script, I cant help your current script because i'm confused what the variables are and what they are pointing to.
Hm.. Try This: I'm assuming u want it to change the text to the coin change when clicked?
local player = game.Players.LocalPlayer -- this line was changed. Now connects to player local coins = script.Parent.Parent.CoinsAmount -- connects to the text local CoinChange = game.ReplicatedStorage.CoinChange -- remote event script.Parent.MouseButton1Click:Connect(function() coins.Text = player.leaderstats.Coins.Value CoinChange:FireServer() end)
Please read below for the errors i found:
Your error is very simple to point out, 'CoinChange' is not a part of workspace, it's in replicated storage, but u put workspace.CoinChange, which may result in a not written error. also, how can text be a part of a remote event? Also, a value cant be part of a remote event or text value at the same time! Also, player cannot connect like that.