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:Destroy() 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)
the local script
local tem = "None" local InputService = game:GetService("UserInputService") InputService.InputBegan:Connect(function(input) -- on local key = input.KeyCode if key == Enum.KeyCode.R then game.ReplicatedStorage.Transfromgold.Trans:FireServer() print("fired") end end) ----- InputService.InputBegan:Connect(function(input) local plr = game.Players.LocalPlayer local chr = plr.Character local hum = chr.Humanoid local key = input.KeyCode if key == Enum.KeyCode.E then game.ReplicatedStorage.Transfromgold.UNDOTRANS:FireServer() end end)
Try this instead
for i,v in pairs(hum:GetChildren()) do if v:IsA("NumberValue") then v:Destroy() end end