What do you want to achieve?
im making a game where it generates parts, i made a textbox where you can type in the number/delay between part every spawns
What is the issue? Include screenshots / videos if possible!
the issue is the textbox doesnt put any text in property
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
no i have no solutions
VALUE MAKER SCRIPT (first attempt)
while wait(0.1) do
local setfff = game.StarterGui.settings.Frame.TextBox.Text
script.Parent.Value = setfff
end
VALUE MAKER SCRIPT (second attempt)
local TextBox = script.Parent.Parent
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
local setfff = tonumber(script.Parent.Parent.InputChanged)
script.Parent.Value = setfff
end)
A RemoteEvent is used for Client-Server communication or vice versa. Whatever is changed on the client, the server cannot see (with very little exceptions). If this is a client-sided script, you will need to use a RemoteEvent to pass on the new value to the server.
game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(player, Parameters) -- the first parameter is always the player
-- do something
end)
Also, I will assume that what you’re trying to do is in a server script.
game.StarterGui.settings.Frame.TextBox.Text
Never do this. StarterGui is merely the gui that the player starts with, the default gui; any changes made to the gui by the player will not change inside StarterGui.
You could insert a LocalScript inside your gui and access the textbox from there:
local TextBox = script.Parent.Parent
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
local setfff = tonumber(script.Parent.Parent.InputChanged)
script.Parent.Value = setfff
end)
(Exactly what you have done, except insert it in a LocalScript)
Then, if you want the server to be able to see the value that you changed, you need to send it through a RemoteEvent.
Okay, I see the issue, you are setting the variable to what the value is at the start and it will not change. Here is the fixed code.
local val = script.delayy
while wait(tonumber(val.Value)) do
print("(generator): the value i see is"..val.Value)
local num = script.part
num.Value = num.Value +1
p = Instance.new("Part",workspace)
p.Size = Vector3.new(5,5,5)
p.Position = Vector3.new(-14.65, 161.47, -16.43)
p.Material = 'Glass'
p.Reflectance = 0.8
p.Transparency = 0.3
end
Note: I would recommend indenting your code. Also, I would recommend not using the 2nd argument of Instance.new() for performance reasons, but instead setting the parent after setting all of the properties. Here is a topic about it.
Oh wait, I see the issue now. You are setting the Value of delayy in a client script but trying to read it from a server script so the server script does not see the changes the client made. I would recommend using RemoteEvents to change the Value of delayy.