game.ReplicatedStorage.Transfromgold.UNDOTRANS.OnServerEvent:Connect(function(plr)

local chr = plr.Character
local hum = chr.Humanoid
local waited = plr.PlayerGui:WaitForChild("er")
        for _,none in pairs(hum:GetChildren()) do
            if none:IsA("NumberValue") then
                none:Remove()
            end
        end  ---this part wont work
                for _,kill in pairs(waited:GetChildren()) do
                    if kill:IsA("NumberValue") then
                    local copy = kill:Clone()
                        copy.Parent = workspace
                    end
                end
---
end)

4 comments

0

You can't access PlayerGui from a server script. Use a remote event to tell the client to edit the gui. Also :remove() is deprecated. Use :Destroy()

0

i am using a remote event it sill dose not work event after destory()

0

Remove is deprecated?

0

yeah it dose not parent the the clone