Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This script will spawn parts but only the amount that was originally on the Gui's Text, help?

Asked by 5 years ago
Edited 5 years ago
script.Parent.MouseButton1Click:Connect(function()
x = game.Workspace.GUIPart.SurfaceGui.TextButton.Text
for i = 1, (x) do
local F9 = Instance.new("Part")
F9.Parent = game.Workspace
F9.CFrame = CFrame.new(-482.5, 57, -2.5)
end
end)

This script is suppose to create a certain number of parts depending on what numbers are on the surface gui. I have local script that will put whatever is on the Screen Gui and put it in the Surface Gui. However this script will spawn parts but only the amount that was originally on the Surface Gui's Text. Is there a way I could make it update to what is now in the gui?

Here is the local script, The script below is in the Starter Gui by the way.

local GuiText = game.Players.LocalPlayer:WaitForChild("PlayerGui").ScreenGui.TextBox --veiw sourse to see full code.
GuiText.Visible = false
game.Workspace.GUIPart.SurfaceGui.TextButton.MouseButton1Click:Connect(function(Yjo)
    GuiText.Visible = true
game.Workspace.GUIPart.SurfaceGui.TextButton.Text = GuiText.Text
end)
0
could you format thecode correctly User#19524 175 — 5y

Answer this question