Hello developers, I was making my spawn button where you type on the TextBox and click the button, but It doesn’t seem to work.
LocalScript:
local Spawn_Entities = game.ReplicatedStorage.Spawn_Entities
local Commands = script.Parent.Scroll.Commands
local SpawnCmd = Commands.SpawnBox
local Entities = {
"A-24",
"A-43",
"A-60",
"A-74",
"A-100",
"A-125",
"A-150",
"A-175",
"A-200",
"A-255",
"A-270",
"A-300",
"A-330",
"A-360",
"A-380"
}
SpawnCmd.Spawn.MouseButton1Click:Connect(function()
for i, v in pairs(Entities) do
if SpawnCmd.Text == v then
Spawn_Entities:FireServer(v)
end
end
end)
ServerScript:
local Entities = game.ServerStorage.Entities
local Spawn_Entities = game.ReplicatedStorage.Spawn_Entities
Spawn_Entities.OnServerEvent:Connect(function(entity)
local entity = Entities:FindFirstChild(entity)
if entity then
local clone = entity:Clone()
clone.Parent = workspace.SpawnedEntities
end
end)