I'm trying to make a gui so that when you click it, an amount of parts spawn.
I also have a gui to determine how many parts to spawn, this is where I'm stuck.
Server Script
game.ReplicatedStorage.CreateEvent.OnServerEvent:Connect(function(player)
print("Works!")
CA = game.ReplicatedStorage.CreateAmount.Value
for i = 1, CA do
wait(0.2)
local deathPart = game.ReplicatedStorage.F9
wait(0.2)
local F9C = deathPart:Clone()
wait(0.2)
F9C.Parent = game.workspace.F9Parent
F9C.Position = Vector3.new(math.random(-590,-460), 57, math.random(-170,60))
end
end)
Local Script
script.Parent.MouseButton1Click:Connect(function()
while true do
game["Run Service"].RenderStepped:wait()
script.Parent.Text = game.Players.LocalPlayer:WaitForChild("PlayerGui").ScreenGui3.TextBox.Text
game.ReplicatedStorage.CreateAmount.Value = script.Parent.Text
end
end)
Even if I change the Number Value in develop mode, it still doesn't spawn any parts and only prints "Works!" once.

2 comments
Are there any errors?
No.