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

This script I made that should delete what the player inputs outputs nothing? [Solved]

Asked by 3 years ago
Edited by Ziffixture 3 years ago

This was solved in the Discord server

So, I've made a script that would work as you expect. The player inputs the name of the object, and after you press the button it will look for said object with the name and delete it. The only problem is, it never outputs anything! It's always nothing, and I have no idea on how to fix it.

local window = script.Parent
local textbox = window.TextBox
local delete = window.TextButton
local text = window.TextLabel
local x = window.TopBar.CloseButton

delete.MouseButton1Click:Connect(function()
    local filename = textbox.Text
    local files = window.Parent.Parent

    print("File name: \""..filename.."\"")
    for i,v in pairs(files:GetChildren()) do
        if v.Name == filename and v.Trashable.Value == true then
            v:Destroy()
        end
    end
end)

x.MouseButton1Click:Connect(function()
    window.Visible = false
end)

Output below

  15:06:24.949   ? File name: "" (x6)  -  Server - Script:11

Is there any way to fix this?

Answer this question